API Reference
Connections

Connections

A connection is an authorized link between your workspace and a social media channel (YouTube channel or Facebook page). Connections are created via the OAuth / Channel Connect flow and used as the target when creating Assignments.

Each connection holds an OAuth access token and a refresh token. When the access token expires the API can silently renew it using POST /refresh-token. If the refresh token itself is no longer valid, the channel must be re-authorized via the OAuth flow.

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


Endpoints

MethodPathDescriptionStatus
GET/api/v1/connectionsList connections200
GET/api/v1/connections/{id}Connection detail200
PATCH/api/v1/connections/{id}Update name, active state, externalId200
POST/api/v1/connections/{id}/refresh-tokenRefresh OAuth token200

GET /api/v1/connections

Returns a paginated list of connections visible to your API key. By default inactive connections are excluded — pass includeInactive=true to include them.

Query parameters

ParameterTypeDescription
platformstringFilter by platform: youtube or facebook
externalIdstringExact match on your custom identifier
includeInactiveboolInclude deactivated connections (default: false)
organizationIdUUIDFilter by organization. See Organizations.
pageintPage number (default: 1)
limitintItems per page (default: 20)

Example request

curl "https://pharlo.io/api/v1/connections?platform=youtube" \
  -H "Authorization: Bearer $DELIVERY_API_KEY"

Response 200 OK

{
  "items": [
    {
      "id": "7f3e1a2b-4c5d-6e7f-8a9b-0c1d2e3f4a5b",
      "platform": "youtube",
      "name": "My YouTube Channel",
      "thumbnailUrl": "https://yt3.ggpht.com/...",
      "isActive": true,
      "tokenExpiresAt": "2026-05-23T10:00:00Z",
      "createdAt": "2026-01-10T08:00:00Z"
    }
  ],
  "total": 1,
  "page": 1,
  "limit": 20
}
FieldTypeDescription
idUUIDConnection ID — use this as connectionId in Assignments
platformstringyoutube or facebook
namestringDisplay name of the channel or page
thumbnailUrlstringAvatar URL from the platform
isActiveboolfalse means publishing assignments to this connection will be rejected
tokenExpiresAtISO 8601When the current access token expires. Refresh proactively using refresh-token.
createdAtISO 8601When this connection was first authorized

GET /api/v1/connections/{id}

Full connection detail including OAuth token status and platform-level metadata.

Example request

curl https://pharlo.io/api/v1/connections/7f3e1a2b-4c5d-6e7f-8a9b-0c1d2e3f4a5b \
  -H "Authorization: Bearer $DELIVERY_API_KEY"

Response 200 OK

{
  "id": "7f3e1a2b-4c5d-6e7f-8a9b-0c1d2e3f4a5b",
  "platform": "youtube",
  "name": "My YouTube Channel",
  "externalPlatformId": "UCxxxxxxxxxxxxxxxxxxxxxx",
  "thumbnailUrl": "https://yt3.ggpht.com/...",
  "isActive": true,
  "tokenStatus": "valid",
  "tokenExpiresAt": "2026-05-23T10:00:00Z",
  "metadata": {
    "subscriberCount": 12400,
    "videoCount": 84
  },
  "createdAt": "2026-01-10T08:00:00Z"
}
FieldTypeDescription
idUUIDConnection ID
platformstringyoutube or facebook
namestringDisplay name
externalPlatformIdstringChannel or page ID from the platform (e.g. UCxxxxxx for YouTube)
thumbnailUrlstringAvatar URL
isActiveboolWhether the connection accepts new assignments
tokenStatusstringSee token status values below
tokenExpiresAtISO 8601Access token expiry time
metadataobjectPlatform-level statistics (subscriber count, video count, etc.)
createdAtISO 8601When this connection was first authorized

Token status values

ValueMeaningAction
validAccess token is currentNone required
expiredAccess token has expired but refresh token may still be validCall refresh-token
missingNo token stored — connection was never fully authorizedRe-run the OAuth flow
⚠️

Assignments submitted to a connection with tokenStatus: expired or missing will fail immediately. Resolve the token status before creating new assignments.


PATCH /api/v1/connections/{id}

Update connection settings. All fields are optional — include only what you want to change.

Request body

FieldTypeDescription
namestringDisplay name shown in the UI and assignment responses
isActiveboolSet to false to deactivate the connection and prevent new assignments. Set to true to re-activate.
externalIdstringYour custom identifier — useful for correlating with your internal system

Deactivating a connection (isActive: false) does not cancel pending assignments that are already in the queue. To stop in-progress publishing, cancel the individual assignments via DELETE /api/v1/assignments/{id}.

Example request

curl -X PATCH https://pharlo.io/api/v1/connections/7f3e1a2b-4c5d-6e7f-8a9b-0c1d2e3f4a5b \
  -H "Authorization: Bearer $DELIVERY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Main YouTube Channel", "isActive": true}'

Response 200 OK

{
  "id": "7f3e1a2b-4c5d-6e7f-8a9b-0c1d2e3f4a5b",
  "name": "Main YouTube Channel",
  "isActive": true,
  "platform": "youtube"
}

POST /api/v1/connections/{id}/refresh-token

Attempt to silently renew the OAuth access token using the stored refresh token. If successful, tokenStatus becomes valid and tokenExpiresAt is updated. No user interaction required.

⚠️

If the refresh token itself has expired (Google: after 7 days of inactivity; Meta: after 60–90 days or on user revocation), this endpoint returns tokenStatus: expired and you must re-run the full OAuth flow to get a fresh token pair.

Example request

curl -X POST https://pharlo.io/api/v1/connections/7f3e1a2b-4c5d-6e7f-8a9b-0c1d2e3f4a5b/refresh-token \
  -H "Authorization: Bearer $DELIVERY_API_KEY"

Response 200 OK

{
  "tokenStatus": "valid",
  "tokenExpiresAt": "2026-05-23T10:00:00Z"
}
FieldTypeDescription
tokenStatusstringvalid if refresh succeeded; expired if the refresh token itself is no longer valid
tokenExpiresAtISO 8601New expiry time when tokenStatus is valid; null when expired

Error responses

StatusReason
400Invalid query parameter or request body field
401Missing or invalid API key
403API key does not have access to this connection
404Connection ID does not exist in this workspace
{
  "error": "Validation failed",
  "details": {
    "platform": ["The value 'tiktok' is not valid. Allowed: youtube, facebook."]
  }
}

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


See also