Events

An event is a record of a user action or outcome. Centrapay performs various tasks in response to events.


POST/api/accounts/{accountId}/events

This endpoint allows you to create an Event   API .

Attributes

  • type

    stringrequired

    The type of Event.

  • idempotencyKey

    stringrequired

    Client-supplied identifier that prevents double creation.

  • data

    object

    An object containing any relevant metadata.

Errors

  • EVENT_ALREADY_EXISTS

    403

    An Event with this idempotencyKey has already been created for the account.

Request
POST/api/accounts/Jaim1Cu1Q55uooxSens6yk/events
curl -X POST \
 https://service.centrapay.com/api/accounts/Jaim1Cu1Q55uooxSens6yk/events \
 -H 'content-type: application/json' \
 -H 'x-api-key: <TOKEN>' \
 -d '
{
 "type": "user-login",
 "idempotencyKey": "login-de32dd90-b46c-11ea-93c3-83a333b86e7b",
 "data": {
  "userId": "b657195e-dc2f-11ea-8566-e7710d592c99-123"
 }
}
'
Response
{
  "id": "L75M3L56N2PtBSt8g7uXLU",
  "accountId": "Jaim1Cu1Q55uooxSens6yk",
  "type": "user-login",
  "data": {
    "userId": "b657195e-dc2f-11ea-8566-e7710d592c99-123"
  },
  "idempotencyKey": "login-de32dd90-b46c-11ea-93c3-83a333b86e7b",
  "createdAt": "2020-05-01T12:30:00.000Z",
  "createdBy": "crn:WIj211vFs9cNACwBb04vQw:api-key:MyApiKey"
}