Update an entity

Operation ID: updateEntity

Group: Accounting › Entities

Open in the interactive reference

PATCH /base/entities/{id}

Retry-safe: A write that accepts Idempotency-Key: repeating a request with the same key replays the stored answer instead of executing twice.

Updates an entity with the fields you send. A field you leave out keeps its current value.

Status moves one way: 'created' to 'active' to 'inactive'. To activate, send status 'active' with a startDate that is not in the future (or rely on the stored one); the entity needs an active parent and at least one complete accounting-book assignment, created on POST accounting/books/entity-assignments and completed on PATCH accounting/books/entity-assignments/:id. To deactivate, send status 'inactive' with an endDate on or after the start date, not after the parent's end date and not before any child's end date; nothing may still depend on the entity. An inactive entity accepts no change: its end date cannot be moved and it cannot be reactivated.

parentEntityId re-parents the entity; it cannot be cleared. A non-legal reporting entity is always top-level and takes no parent (FIELD_NOT_ALLOWED); a legal entity may be moved under one. currency cannot change once the entity has sales arrangements, customers, invoices or journal entries, and it is never copied to a book assignment. When multi-book is off, an entity assigned to a book keeps that book's currency: any other currency fails with INVALID_FIELD_VALUE, and every save aligns a differing stored currency with the book's (ENTITY_HAS_TRANSACTIONS when that would move a locked currency). Any save of an active entity needs its book assignments complete (INCOMPLETE_BOOK_ASSIGNMENT).

Clearing: send an empty string to clear country, entityCode, localeCode, registeredAddress.line2, registeredAddress.stateProvince or an external identifier's externalUrl. currency and timeZone cannot be cleared (FIELD_REQUIRED). registeredAddress changes only the sub-fields you send; when the entity has no address yet, send line1, city, country and zipCode to create it.

The response is empty. Read the updated record with GET base/entities/:id. Every call sends the Api-Version header: a missing or empty header, or an unknown version, answers 400; a route the requested version does not contain answers 404.

Parameters

Name In Type Required Description
Api-Version header string · v1 yes The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version v1.
Idempotency-Key header string no An opaque caller-chosen string (1-255 characters) that makes this request safe to retry. Repeating the same key with an identical request body replays the original response instead of re-executing - but only once that original request succeeded; a failed attempt re-executes on retry. Repeating the key with a different body is answered with 422. A key still in flight is answered with 409 - as is a key whose original request was interrupted before it finished, for a few minutes afterwards, until that attempt is presumed dead. A completed response stays replayable for 24 hours. The key is scoped to the caller, not to the action: reusing it for a different action is answered with 409 or 422 rather than treated independently. On read actions this header is ignored. On write actions that cannot offer the guarantee it is answered with 400 IDEMPOTENCY_NOT_SUPPORTED rather than silently ignored.
id path string yes The unique identifier of the entity to update.

Request body

Required, application/json: updateEntityInput.

Field Type Required Description
entityName string no The name of the entity. At most 120 characters; must be unique within the tenant. Omit to leave unchanged.
status string no The lifecycle status to move the entity to: 'active' activates a created entity, 'inactive' deactivates an active one (with endDate). Sending the entity's current status changes nothing. An inactive entity's end date cannot be moved. Omit to leave unchanged. One of: "active", "inactive". Example: "active".
parentEntityId string no The parent entity in the hierarchy. Cannot be the entity itself or one of its descendants, and cannot change once the entity has a chart of accounts in a book. It cannot be cleared. Not accepted on a non-legal reporting entity, which is always top-level (FIELD_NOT_ALLOWED); a legal entity may name a non-legal reporting entity as its parent. Omit to leave unchanged. See id on GET base/entities/:id.
currency string no The entity's functional currency. Format ISO 4217, for example 'USD'. A code outside the supported currencies fails with INVALID_FIELD_VALUE. Locked once the entity has transactions. When multi-book is off and the entity has a book assignment, only that book's currency is accepted. Cannot be cleared. Omit to leave unchanged.
timeZone string no The time zone the entity operates in. Format IANA time-zone name, for example 'Europe/Berlin'. An unknown zone fails with INVALID_FIELD_VALUE. Cannot be cleared. Omit to leave unchanged.
country string no The country the entity is registered in. Format ISO 3166-1 alpha-2, for example 'US'. An unknown code fails with INVALID_FIELD_VALUE. Send an empty string to clear it. Omit to leave unchanged.
entityCode string no A short code for the entity, separate from its entityNumber. Send an empty string to clear it. Omit to leave unchanged.
localeCode string no The locale for documents sent from this entity. Format BCP 47, for example 'en-US'. A locale the tenant does not offer fails with INVALID_FIELD_VALUE. Send an empty string to clear it. Omit to leave unchanged.
startDate date no The date the entity becomes effective. Format YYYY-MM-DD. Cannot be before the parent's start date or after a child's, and cannot be in the future on an active entity (DATE_CONFLICT). Postponing it fails when records before the new date depend on the entity. Omit to leave unchanged. Example: "2026-01-01".
endDate date no The date the entity stops being effective. Format YYYY-MM-DD. Accepted only when deactivating an active entity (status 'inactive'). Must be on or after startDate, on or before the parent's end date, and on or after every child's end date.
registeredAddress object no Changes to the registered address. Only the sub-fields you send change. Omit to leave the address unchanged.
registeredAddress.line1 string no The first address line. Cannot be cleared. Omit to leave unchanged.
registeredAddress.line2 string no The second address line. Send an empty string to clear it. Omit to leave unchanged.
registeredAddress.city string no The city or locality. Cannot be cleared. Omit to leave unchanged.
registeredAddress.stateProvince string no The state, province, or region. Send an empty string to clear it. Omit to leave unchanged.
registeredAddress.country string no The country of the address. Format ISO 3166-1 alpha-2, for example 'US'. An unknown code fails with INVALID_FIELD_VALUE. Cannot be cleared. Omit to leave unchanged.
registeredAddress.zipCode string no The postal or ZIP code. Cannot be cleared. Omit to leave unchanged.
createExternalIdentifiers array<object> no External identifiers to add. A fieldName the entity already has fails with DUPLICATE_EXTERNAL_IDENTIFIER. List the configured fieldNames on GET base/entity-external-identifier-fields; any other fails with UNKNOWN_EXTERNAL_IDENTIFIER.
createExternalIdentifiers[].fieldName string yes The configured key of the external identifier.
createExternalIdentifiers[].value string yes The identifier as the source system holds it. Cannot be empty.
createExternalIdentifiers[].externalUrl string no An absolute http(s) link to the object in the source system. Anything else fails with INVALID_FIELD_VALUE.
updateExternalIdentifiers array<object> no External identifiers to rewrite, matched by fieldName. A fieldName the entity does not have fails with EXTERNAL_IDENTIFIER_NOT_FOUND.
updateExternalIdentifiers[].fieldName string yes The configured key of the entry to rewrite.
updateExternalIdentifiers[].value string yes The identifier as the source system holds it. Cannot be empty.
updateExternalIdentifiers[].externalUrl string no An absolute http(s) link to the object in the source system. Anything else fails with INVALID_FIELD_VALUE. Send an empty string to clear the stored link. Omit to keep it.
deleteExternalIdentifiers array<string> no The fieldNames of external identifiers to remove. A fieldName the entity does not have fails with EXTERNAL_IDENTIFIER_NOT_FOUND. An entry whose configuration was retired can still be removed.
{}

Response

200 Success

{
  "data": {},
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}

Response headers

Errors

Code Status
NOT_FOUND 400
PARENT_ENTITY_NOT_FOUND 400
FIELD_REQUIRED 400
FIELD_TOO_LONG 400
FIELD_NOT_ALLOWED 400
INVALID_FIELD_VALUE 400
DUPLICATE_ENTITY_NAME 400
INVALID_PARENT_ENTITY 400
INVALID_STATUS_TRANSITION 400
DATE_CONFLICT 400
ENTITY_NOT_EDITABLE 400
ENTITY_HAS_TRANSACTIONS 400
INCOMPLETE_BOOK_ASSIGNMENT 400
UNKNOWN_EXTERNAL_IDENTIFIER 400
DUPLICATE_EXTERNAL_IDENTIFIER 400
EXTERNAL_IDENTIFIER_NOT_FOUND 400
IDEMPOTENCY_KEY_CONFLICT 409
IDEMPOTENCY_PAYLOAD_MISMATCH 422

Statuses