Create an auditable entity

Register a legal entity so you can link audit logs to it with audit_for.

An auditable entity is a legal entity you report for, such as a subsidiary. After you create it, pass its id as audit_for in a calculation request, and every audit log the request creates is linked to the entity. See Audit mode.

Audit logging must be enabled for your account.

Request

POST /v2/audits/entities

legal_namestring

The legal name of the entity.

emailstring

The email address associated with the entity.

vat_idstring

The entity's VAT identification number.

external_idstring

Your own identifier for the entity, to link it to a record in your system.

addressobject

The entity's address. Some legal documents, such as invoices, need a full address. If you send an address, line1, city, postal_code and country_alpha2 are required.

See every field of POST /v2/audits/entities in the API reference

Address fields

line1stringrequired

Street name and number, P.O. box or c/o.

line2string

Additional address information, such as building or floor.

citystringrequired

City, town or village.

postal_codestringrequired

ZIP or postal code.

statestring

County, province, region or state.

country_alpha2stringrequired

ISO 3166-1 alpha-2 country code, such as DE. Three-letter alpha-3 codes, such as DEU, are accepted too.

emailstring

Email address associated with this address.

Example request body:

{
  "legal_name": "Example Company GmbH",
  "email": "accounting@example.com",
  "vat_id": "DE123456789",
  "external_id": "ENTITY-001",
  "address": {
    "line1": "Example Street 1",
    "line2": "Building A",
    "city": "Berlin",
    "postal_code": "10115",
    "state": "BE",
    "country_alpha2": "DE",
    "email": "accounting@example.com"
  }
}

Save it as entity.json and send it:

curl --request POST "https://api.sandbox.squake.earth/v2/audits/entities" \
  --header "Authorization: Bearer $SQUAKE_API_KEY" \
  --header "Content-Type: application/json" \
  --data @entity.json

Response

SQUAKE responds with 201 Created. The body is an array that holds the created entity:

201 Createdapplication/json
[
  {
    "id": "d3427e0d-5a3c-40ce-842e-5552e77caa4f",
    "legal_name": "Example Company GmbH",
    "email": "accounting@example.com",
    "vat_id": "DE123456789",
    "external_id": "ENTITY-001",
    "address": {
      "line1": "Example Street 1",
      "line2": "Building A",
      "city": "Berlin",
      "postal_code": "10115",
      "state": "BE",
      "country_alpha2": "DE",
      "email": "accounting@example.com"
    }
  }
]

Store the id. It's the value you pass as audit_for when you calculate for this entity.

The API has no endpoint to update or delete an auditable entity. To link future calculations to corrected details, create a new entity and use its id. Audit logs are immutable, so logs that are already linked to the old entity keep that link.

Errors

StatusMeaning
403Authentication or authorization failed. Check that audit logging is enabled for your account.

On this page

POST/v2/audits/entities

Run this request against the sandbox with your test key.

Open in API reference