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_namestringThe legal name of the entity.
emailstringThe email address associated with the entity.
vat_idstringThe entity's VAT identification number.
external_idstringYour own identifier for the entity, to link it to a record in your system.
addressobjectThe 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.
POST /v2/audits/entities in the API referenceAddress fields
line1stringrequiredStreet name and number, P.O. box or c/o.
line2stringAdditional address information, such as building or floor.
citystringrequiredCity, town or village.
postal_codestringrequiredZIP or postal code.
statestringCounty, province, region or state.
country_alpha2stringrequiredISO 3166-1 alpha-2 country code, such as DE. Three-letter alpha-3 codes, such as DEU, are accepted too.
emailstringEmail 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.jsonResponse
SQUAKE responds with 201 Created. The body is an array that holds the created entity:
[
{
"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
| Status | Meaning |
|---|---|
403 | Authentication or authorization failed. Check that audit logging is enabled for your account. |
Related
- List auditable entities
- Audit mode
- Create a new Auditable entity in the API reference