POST
https://www.app.ocoya.com/api/_public/v1/contacts
Create a contact
curl --request POST \
  --url https://www.app.ocoya.com/api/_public/v1/contacts \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "email": "jane@example.com",
  "firstName": "<string>",
  "lastName": "<string>",
  "properties": {},
  "groups": [
    "Customers"
  ],
  "consentText": "<string>"
}
'
{
  "id": "cmwdke27h0045y0k4fi0tm5pj",
  "email": "jane@example.com",
  "firstName": "Jane",
  "lastName": "<string>",
  "properties": {},
  "status": "subscribed",
  "source": "api",
  "consentAt": "<string>",
  "consentText": "<string>",
  "unsubscribedAt": "<string>",
  "lastSentAt": "<string>",
  "lastOpenedAt": "<string>",
  "lastClickedAt": "<string>",
  "groups": [
    {
      "id": "<string>",
      "name": "<string>"
    }
  ],
  "createdAt": "<string>",
  "updatedAt": "<string>",
  "created": true
}

Authorizations

X-API-Keystringheaderrequired

Your API key. Create one in Ocoya. Authorization: Bearer <key> works too.

Query Parameters

brandIdstringrequired

Ocoya brand ID. Get one from GET /brands.

Example:"cmayvq3hk00017apshay5qezu"

Body

application/json
emailstringrequired
Example:"jane@example.com"
firstNamestring
lastNamestring
propertiesobject

Extra fields, merged into the contact's.

groupsstring[]

Group names; missing ones are created.

Example:
[
  "Customers"
]

How the person agreed, kept as their consent record.

Response

application/json

Already a contact, filled in

idstring
Example:"cmwdke27h0045y0k4fi0tm5pj"
emailstring
Example:"jane@example.com"
firstNamestring | null
Example:"Jane"
lastNamestring | null
propertiesobject | null

Extra fields.

statusenum<string>
Available options: subscribed, unsubscribed, bounced, complained
Example:"subscribed"
sourcestring

manual, import, form, bio, api or workflow.

Example:"api"

How they agreed: their consent record.

unsubscribedAtstring | null
lastSentAtstring | null
lastOpenedAtstring | null
lastClickedAtstring | null
groupsobject[]
Show child attributesHide child attributes
groups.idstring
groups.namestring
createdAtstring
updatedAtstring
createdboolean