API Reference
Assignments

Assignments

An assignment is a publishing job that sends content to a connected social media channel. Each assignment moves through a lifecycle from pending to published (or failed).

Before creating an assignment you need a connectionId — get one from Connections. The payload structure depends on the target platform; see Platform Capabilities for the full schema per platform.

Base URL: https://pharlo.io
Auth: Authorization: Bearer ds_live_...


Endpoints

MethodPathDescriptionStatus
POST/api/v1/assignmentsCreate a publishing assignment201
GET/api/v1/assignmentsPaginated list200
GET/api/v1/assignments/{id}Assignment detail200
PATCH/api/v1/assignments/{id}Update payload or schedule200
POST/api/v1/assignments/{id}/retryRetry a failed assignment200
DELETE/api/v1/assignments/{id}Cancel assignment204

POST /api/v1/assignments

Create a new publishing job.

Request body

FieldTypeRequiredDescription
connectionIdUUIDYesID of the channel connection to publish to. See Connections.
typestringYesContent type: video, image, link, text, reel, short, story, carousel. Available types depend on the platform — see Platform Capabilities.
payloadobjectYesPlatform-specific fields (title, description, privacy, tags, etc.). The accepted fields and their constraints vary by platform and type.
mediaUrlstringNoPublicly accessible media URL. Required for video and image types. The API downloads from this URL at publish time.
mediaContentTypestringNoMIME type of the media file (e.g. video/mp4, image/jpeg).
mediaSizeBytesintNoMedia file size in bytes. Used for upload progress tracking.
scheduledAtISO 8601NoScheduled publish time. Must include an explicit timezone offset (e.g. +03:00). Omit for immediate publishing.
callbackUrlstringNoWebhook URL called on every status change. See Webhook guide and Webhook deliveries.
idempotencyKeystringNoUnique string to prevent duplicate submissions on retry.
externalIdstringNoYour own identifier for this assignment — useful for correlating with your internal system.

Idempotency — if you retry a failed HTTP request, include the same idempotencyKey. The API will return the original assignment instead of creating a duplicate. Keys expire after 24 hours.

⚠️

Scheduled time timezone — always pass scheduledAt with an explicit offset such as 2026-04-25T18:00:00+03:00. Bare UTC strings (Z) are accepted but ambiguous for users in other timezones. The response always returns scheduledAt normalized to UTC.

Example request

curl -X POST https://pharlo.io/api/v1/assignments \
  -H "Authorization: Bearer $DELIVERY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "connectionId": "7f3e1a2b-4c5d-6e7f-8a9b-0c1d2e3f4a5b",
    "type": "video",
    "payload": {
      "title": "Product Demo",
      "description": "See what is new in v2",
      "privacy": "public"
    },
    "mediaUrl": "https://cdn.example.com/demo.mp4",
    "scheduledAt": "2026-04-25T18:00:00+03:00",
    "callbackUrl": "https://your-server.com/webhook"
  }'

Response 201 Created

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "pending",
  "connectionId": "7f3e1a2b-4c5d-6e7f-8a9b-0c1d2e3f4a5b",
  "platform": "youtube",
  "type": "video",
  "scheduledAt": "2026-04-25T15:00:00Z",
  "createdAt": "2026-04-23T10:00:00Z"
}

GET /api/v1/assignments

Paginated list of assignments. Use filters to narrow results by status, platform, or date range.

Query parameters

ParameterTypeDescription
pageintPage number (default: 1)
limitintItems per page (default: 20, max: 50)
statusstringpending, uploading, uploaded, processing, published, failed, cancelled
platformstringyoutube, facebook
connectionIdUUIDFilter by a specific channel connection
externalIdstringExact match on your custom identifier
dateFromISO 8601Return assignments created after this date
dateToISO 8601Return assignments created before this date

Example request

curl "https://pharlo.io/api/v1/assignments?status=published&limit=10" \
  -H "Authorization: Bearer $DELIVERY_API_KEY"

Response 200 OK

{
  "items": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "status": "published",
      "platform": "youtube",
      "type": "video",
      "platformUrl": "https://youtu.be/dQw4w9WgXcQ",
      "publishedAt": "2026-04-25T15:02:35Z",
      "createdAt": "2026-04-23T10:00:00Z"
    }
  ],
  "total": 1,
  "page": 1,
  "limit": 10
}

GET /api/v1/assignments/{id}

Full assignment detail including status, errors, platform URL, and payload.

Assignment lifecycle

Assignments progress through the following statuses in order. Once published, the platformUrl field is populated with the live URL.

StatusMeaning
pendingQueued, not yet started
uploadingMedia is being transferred to the platform
uploadedMedia uploaded; platform is applying metadata
processingPlatform is processing the content (e.g. transcoding)
publishedLive on the platform — platformUrl is set
failedProcessing failed — check the errors array for details
cancelledManually cancelled via DELETE — cannot be restarted

If an assignment reaches failed, inspect errors for the root cause, fix the underlying issue (e.g. update payload via PATCH), and then call the retry endpoint. cancelled assignments cannot be retried — create a new one instead.

Example request

curl https://pharlo.io/api/v1/assignments/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
  -H "Authorization: Bearer $DELIVERY_API_KEY"

Response 200 OK — published

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "published",
  "platform": "youtube",
  "type": "video",
  "platformPostId": "dQw4w9WgXcQ",
  "platformUrl": "https://youtu.be/dQw4w9WgXcQ",
  "publishedAt": "2026-04-25T15:02:35Z",
  "payload": {
    "title": "Product Demo",
    "privacy": "public"
  }
}

Response 200 OK — failed

When status is failed, the errors array contains one or more platform error codes with human-readable messages. Use these to diagnose the issue before retrying.

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "failed",
  "platform": "youtube",
  "type": "video",
  "errors": [
    {
      "code": "QUOTA_EXCEEDED",
      "message": "YouTube daily upload quota exceeded for this channel."
    }
  ],
  "payload": {
    "title": "Product Demo",
    "privacy": "public"
  },
  "createdAt": "2026-04-23T10:00:00Z"
}

PATCH /api/v1/assignments/{id}

Update a pending or uploaded assignment before it is processed. You can change the payload (title, description, privacy, etc.) or reschedule with a new scheduledAt.

To update metadata of an already published YouTube video (e.g. change the title or description), include "updatePublished": true. This sends the updated payload to the platform directly without changing the assignment status.

⚠️

PATCH is only allowed on pending and uploaded assignments (or any status when using updatePublished: true for published YouTube videos). Attempting to update a processing, failed, or cancelled assignment returns 409 Conflict.

Example — reschedule and update title

curl -X PATCH https://pharlo.io/api/v1/assignments/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
  -H "Authorization: Bearer $DELIVERY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "scheduledAt": "2026-04-26T18:00:00+03:00",
    "payload": {
      "title": "Updated Title",
      "privacy": "public"
    }
  }'

Example — update an already-published YouTube video

curl -X PATCH https://pharlo.io/api/v1/assignments/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
  -H "Authorization: Bearer $DELIVERY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "updatePublished": true,
    "payload": {
      "title": "Product Demo — Final Cut",
      "description": "Updated description with corrected links.",
      "privacy": "public"
    }
  }'

Response 200 OK

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "pending",
  "scheduledAt": "2026-04-26T15:00:00Z",
  "payload": {
    "title": "Updated Title",
    "privacy": "public"
  }
}

POST /api/v1/assignments/{id}/retry

Re-queue a failed assignment without creating a new one. The assignment status resets to pending and it re-enters the processing queue.

Before retrying, consider updating the payload via PATCH if the failure was caused by invalid metadata (e.g. a title that exceeds the platform character limit). See the errors array on the detail response for the failure reason.

Example request

curl -X POST https://pharlo.io/api/v1/assignments/a1b2c3d4-e5f6-7890-abcd-ef1234567890/retry \
  -H "Authorization: Bearer $DELIVERY_API_KEY"

Response 200 OK

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "pending"
}

DELETE /api/v1/assignments/{id}

Cancel a pending or scheduled assignment. Cancellation is permanent — cancelled assignments cannot be restarted. To publish the same content again, create a new assignment.

Example request

curl -X DELETE https://pharlo.io/api/v1/assignments/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
  -H "Authorization: Bearer $DELIVERY_API_KEY"

Returns 204 No Content on success. No response body.


Error responses

StatusCodeReason
400VALIDATION_ERRORMissing required field or invalid value
401UNAUTHORIZEDMissing or invalid API key
403FORBIDDENKey does not have access to this resource
404NOT_FOUNDAssignment ID does not exist
409CONFLICTOperation not allowed in current assignment status
{
  "error": "Validation failed",
  "details": {
    "connectionId": ["This value should not be blank."],
    "type": ["The value 'clip' is not a valid content type."]
  }
}

For a full guide on handling errors and retries, see Error Handling.


See also