---
title: "Set an entity's aliases, domains, exclusions and context terms"
method: PUT
path: "/entities/{entityId}"
tags: ["entities"]
---

# Set an entity's aliases, domains, exclusions and context terms

`PUT /entities/{entityId}`

## Request

- Base URL: `https://shruwd.io/api/v1`
- URL: `https://shruwd.io/api/v1/entities/{entityId}`
- Auth: HTTP bearer

The **desired** state. The server diffs against the current rows: what
is gone is closed as of now, what is new is added, what is unchanged is
untouched. A run executed yesterday still resolves against yesterday's
aliases. Works for the self entity too. A generic name cannot have its
context terms removed, and a generic alias is refused without them.

## Request body

- EntityConfig
  - `aliases` AliasInput[]: Defaults to the entity's name.
    - `alias` string, required: An exact string, matched on token boundaries. Not a pattern.
    - `kind` 'name' | 'product' | 'abbreviation' | 'misspelling'
    - `caseSensitive` boolean
  - `domains` string[]: Hosts or URLs; reduced to registrable domains. A citation of one of them counts for this entity.
  - `exclusions` string[]: Literal phrases that contain an alias but are not the entity ("arc welding" for "Arc").
  - `contextTerms` string[]: When non-empty, a mention counts only if one of these appears nearby. Required for short or common-word names. The entity's domains are added to them.

## Response `200`

The entity as it now is.

- Entity
  - `entityId` string, required
  - `name` string, required
  - `isSelf` boolean, required: True for the brand itself.
  - `requiresContext` boolean, required: Mentions count only near one of `contextTerms`.
  - `needsContextTerms` boolean, required: The name or an alias is six characters or fewer or an ordinary English word, so the entity needs context terms to count only real mentions. True with `requiresContext` false means the entity is matching without them; set some with PUT /entities/{entityId}, or remove the alias.
  - `genericSpelling` string, nullable, required: The spelling, name or alias, that makes `needsContextTerms` true; null when none does.
  - `contextTerms` string[], required
  - `aliases` Alias[], required
    - `aliasId` string, required
    - `alias` string, required
    - `kind` 'name' | 'product' | 'abbreviation' | 'misspelling', required
    - `caseSensitive` boolean, required: True for acronyms: `SAP`, not `sap`.
  - `domains` string[], required
  - `exclusions` string[], required
  - `createdAt` string, date-time, required

## Other responses

- `404`: `not_found`: no such resource in this workspace.
- `409`: `domain_taken`.
- `422`: `context_terms_required`, `invalid_alias`, `invalid_domain`.
- `default`: Every failure has this body.

---

[API](https://skmtc.dev/shruwd/apis/shruwd-api.md) · [All operations](https://skmtc.dev/shruwd/apis/shruwd-api/llms.txt) · [OpenAPI document](https://skmtc.dev/shruwd/apis/shruwd-api/revisions/64a5da079928?raw)
