Docs
API Reference

Events

Append immutable events to document timelines in the Carrot API.

Events are the primary mechanism for evolving document state. After a document is created, all relevant changes are recorded as new events.

Create event

POST
/documents/{documentId}/events

Authorization

OAuth2ClientCredentials
AuthorizationBearer <token>

OAuth 2.0 Client Credentials authentication.

In: header

Path Parameters

documentId*string

Document identifier

Header Parameters

Authorization*string

Authorization bearer token

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://api.carrot.eco/documents/string/events" \  -H "Authorization: string" \  -H "Content-Type: application/json" \  -d '{    "externalCreatedAt": "2020-01-01T00:00:00.000Z",    "isPublic": true,    "name": "CLOSE"  }'
{
  "documentId": "28b04f62-8fe2-4332-b854-fe8a922788b5",
  "eventId": "JrSRCUhKOxKyUujM2DkH9"
}
Empty
Empty
Empty

Use POST /documents/{documentId}/events to append one event to a document timeline.

Batch events

POST
/documents/events

Authorization

OAuth2ClientCredentials
AuthorizationBearer <token>

OAuth 2.0 Client Credentials authentication.

In: header

Header Parameters

Authorization*string

Authorization bearer token

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://api.carrot.eco/documents/events" \  -H "Authorization: string" \  -H "Content-Type: application/json" \  -d '{    "events": [      {        "externalCreatedAt": "2020-01-01T00:00:00.000Z",        "isPublic": true,        "name": "Pick-up"      }    ]  }'
{
  "documentId": "28b04f62-8fe2-4332-b854-fe8a922788b5",
  "events": [
    {
      "eventId": "string",
      "targetDocumentId": "string"
    }
  ]
}
Empty
Empty
Empty

Use POST /documents/events to create multiple events for a document in a single request. Each event in the batch follows the same schema and validation rules as the single-document endpoint above.

Logical event types

TypePurpose
ACTORAdds a participant role on the document and can update permissions.
CLOSECloses the document for future updates (except specific relation workflows).
CANCELCancels the document and blocks future actions.
RELATEDLinks this document to another document.
UPDATEUpdates specific document visibility fields.
SPLITCreates a new document with part of the original value. No dedicated schema — represented via target payload fields.
OUTPUTCreates a new downstream document from current data. No dedicated schema — represented via target payload fields.
CUSTOMMethodology-specific event names not covered by built-in types.

The current schema defines six discriminated event schemas (CloseEvent, ActorEvent, CancelEvent, RelatedEvent, UpdateEvent, CustomEvent). SPLIT and OUTPUT do not have their own schemas and are instead represented through event data using the target payload fields.

Ordering and consistency

  • externalCreatedAt must be before current time.
  • externalCreatedAt must be equal to or later than the last recorded event.
  • Use deduplicationId when retrying event submissions.

Event propagation

When propagateEvent is enabled, propagation applies only one relationship level deep. Some event combinations are restricted (for example, propagated events cannot send value).

For complete event definitions and methodology alignment, see Event Specification.

On this page