POST
https://www.app.ocoya.com/api/_public/v1/post/{postId}/approval
Request post approval
curl --request POST \
  --url https://www.app.ocoya.com/api/_public/v1/post/{postId}/approval \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "approvers": [
    "jane@example.com"
  ],
  "scheduledAt": "2024-01-01T00:00:00Z"
}
'
{
  "postGroupId": "cmajvvb9q0003ja5vh0538j6r",
  "brandId": "cmayvq3hk00017apshay5qezu",
  "status": "PENDING_INTERNAL_APPROVAL",
  "scheduledAt": "2024-01-01T00:00:00Z",
  "state": "pending",
  "requestedBy": {
    "id": "clh49n2u300008kovd2wq1p8z",
    "name": "Ocoya"
  },
  "requestedAt": "2024-01-01T00:00:00Z",
  "approvers": [
    {
      "id": "clh49n2u300008kovd2wq1p8z",
      "email": "jane@example.com",
      "name": "Jane",
      "role": "ADMIN"
    }
  ],
  "answeredBy": null,
  "answeredAt": null,
  "comments": [
    {
      "id": "<string>",
      "text": "Can we use the blue photo instead?",
      "kind": "comment",
      "parentId": "<string>",
      "author": {
        "id": "clh49n2u300008kovd2wq1p8z",
        "name": "Aivaras",
        "email": "jane@example.com"
      },
      "createdAt": "2024-01-01T00:00:00Z"
    }
  ],
  "asked": [
    "jane@example.com"
  ]
}

Authorizations

X-API-Keystringheaderrequired

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

Path Parameters

postIdstringrequired

Ocoya post ID.

Example:"cmajvvb9q0003ja5vh0538j6r"

Body

application/json
approversstring[]required

Email addresses of the brand members who should approve the post. Everyone named must be a member of the post's brand, or nothing changes. People already asked are not asked again.

Required array length: 1 - 10 elements
Example:
[
  "jane@example.com"
]
scheduledAtstring | null

ISO 8601 datetime, in the future, when the post goes out once approved. Left out: the post keeps its own time. null: no time, so approved it stays a draft.

Example:"2024-01-01T00:00:00Z"

Response

application/json

Asked. The approval as GET /post/{postId}/approval returns it, plus asked: the emails newly asked by this call.

postGroupIdstring

ID of the post.

Example:"cmajvvb9q0003ja5vh0538j6r"
brandIdstring

The post's brand.

Example:"cmayvq3hk00017apshay5qezu"
statusenum<string>

The post's status: PENDING_INTERNAL_APPROVAL while it waits.

Available options: GENERATING, DRAFT, PENDING_CLIENT_APPROVAL, PENDING_INTERNAL_APPROVAL, SCHEDULED, POSTED, NEEDS_ATTENTION, ERROR
Example:"PENDING_INTERNAL_APPROVAL"
scheduledAtstring | null

When it goes out once approved, or null: approved without a time, it stays a draft.

Example:"2024-01-01T00:00:00Z"
stateenum<string>

pending - waiting on approvers. approved - approved: scheduled for scheduledAt if that is still to come, else a draft. rejected - rejected: back to draft. cancelled - the request was taken back. none - never sent for approval.

Available options: pending, approved, rejected, cancelled, none
Example:"pending"
requestedByobject | null

Who asked, while pending.

Example:
{
  "id": "clh49n2u300008kovd2wq1p8z",
  "name": "Ocoya"
}
Show child attributesHide child attributes
requestedBy.idstring
requestedBy.namestring | null
requestedAtstring | null

When the approvers were last asked, while pending.

Example:"2024-01-01T00:00:00Z"
approversobject[]

Who it waits on, while pending. Any one of them approving or rejecting answers for all.

Show child attributesHide child attributes
approvers.idstring
Example:"clh49n2u300008kovd2wq1p8z"
approvers.emailstring | null
Example:"jane@example.com"
approvers.namestring | null
Example:"Jane"
approvers.rolestring | null
Example:"ADMIN"
answeredByobject | null

Who approved, rejected or cancelled it.

Show child attributesHide child attributes
answeredBy.idstring
Example:"clh49n2u300008kovd2wq1p8z"
answeredBy.namestring | null
Example:"Aivaras"
answeredBy.emailstring | null
Example:"jane@example.com"
answeredAtstring | null

When.

commentsobject[]

The post's comments, oldest first (the last 50): what approvers wrote, and Ocoya's status lines.

Show child attributesHide child attributes
comments.idstring
comments.textstring
Example:"Can we use the blue photo instead?"
comments.kindenum<string>

comment - written by a person. system - a line Ocoya adds, such as Pending approval or Rejected post.

Available options: comment, system
comments.parentIdstring | null

The comment this one replies to.

comments.authorobject | null
Show child attributesHide child attributes
comments.author.idstring
Example:"clh49n2u300008kovd2wq1p8z"
comments.author.namestring | null
Example:"Aivaras"
comments.author.emailstring | null
Example:"jane@example.com"
comments.createdAtstring
Example:"2024-01-01T00:00:00Z"
askedstring[]
Example:
[
  "jane@example.com"
]