SDKs & Tools
Postman Collection

Postman Collection

Import the Pharlo collection into Postman to explore and test all endpoints interactively — no code required.


Import from OpenAPI spec

Open Postman and click Import

In the top-left corner click Import (or press Ctrl+O / Cmd+O).

Select the URL tab

Choose Link and enter the live OpenAPI spec URL:

https://pharlo.io/api/doc.json

Confirm and import

Postman parses the spec and generates a collection with all endpoints grouped by resource. Click Import to confirm.

Set up an environment

Before making any requests, create an environment with your credentials — see Environment setup below.

The spec is auto-generated from the codebase and always reflects the current production API.

See OpenAPI Spec for more details and client generation options.


Environment setup

Postman environments let you switch between credentials without editing requests. Create one environment per workspace or API key.

Create a new environment

Go to Environments (left sidebar) → click + → name it Pharlo.

Add these variables

VariableInitial valueDescription
base_urlhttps://pharlo.ioAPI base URL
api_keyds_live_your_key_hereYour API key from Settings → Credentials
connection_id(leave empty)Fill in after calling GET /connections

Activate the environment

Select Pharlo from the environment dropdown (top-right corner of Postman). All {{variable}} references in requests will now resolve to your values.

⚠️

Store your api_key in the Current value column, not Initial value. Current values are kept local and are never synced to Postman cloud or shared with teammates.

You can also import the environment as JSON. Save the following as delivery-api-environment.json and import it via Environments → Import:

{
  "name": "Pharlo",
  "values": [
    { "key": "base_url",       "value": "https://pharlo.io", "enabled": true },
    { "key": "api_key",        "value": "ds_live_your_key_here",           "enabled": true, "type": "secret" },
    { "key": "connection_id",  "value": "",                                "enabled": true },
    { "key": "assignment_id",  "value": "",                                "enabled": true }
  ]
}

Authorization

Option A — set per-request (quick)

In each request's Authorization tab, choose Bearer Token and enter {{api_key}}.

Option B — set on the collection (recommended)

Set the auth once on the entire collection so every request inherits it automatically:

  1. Click the imported collection → EditAuthorization tab
  2. Set type to Bearer Token
  3. Enter {{api_key}} as the token value
  4. Click Save

All requests in the collection will now send Authorization: Bearer {{api_key}} without any per-request config.


Pre-request script — auto-set connection_id

If you want connection_id populated automatically from your first connection, add this pre-request script to the collection:

// Runs before every request that uses {{connection_id}}
if (!pm.environment.get("connection_id")) {
    pm.sendRequest(
        {
            url: pm.environment.get("base_url") + "/api/v1/connections",
            method: "GET",
            header: {
                Authorization: "Bearer " + pm.environment.get("api_key"),
            },
        },
        (err, response) => {
            const body = response.json();
            if (body.items && body.items.length > 0) {
                pm.environment.set("connection_id", body.items[0].id);
                console.log("connection_id set to", body.items[0].id);
            }
        }
    );
}

Add it in Collection → Edit → Pre-request Script.


Quick test — verify your setup

After importing and setting up the environment, run this request to confirm authentication works:

GET {{base_url}}/api/v1/connections
Authorization: Bearer {{api_key}}

A 200 response with your channel list confirms everything is working. If you get 401, check that api_key is set in the active environment.

Test script — add this to the request's Tests tab to auto-save your first connection ID:

pm.test("Status is 200", () => {
    pm.response.to.have.status(200);
});
 
const body = pm.response.json();
if (body.items && body.items.length > 0) {
    pm.environment.set("connection_id", body.items[0].id);
    console.log("Saved connection_id:", body.items[0].id);
}

Common requests

These are the requests you'll use most often. All use collection variables.

List connections

GET {{base_url}}/api/v1/connections

Returns all authorized channels. Copy a UUID into {{connection_id}} for assignment requests.

Create an assignment (publish video)

POST {{base_url}}/api/v1/assignments
Content-Type: application/json

{
  "connectionId": "{{connection_id}}",
  "type": "video",
  "mediaUrl": "https://cdn.example.com/demo.mp4",
  "payload": {
    "title": "Product Demo",
    "description": "See what's new",
    "privacy": "public"
  },
  "scheduledAt": "2026-05-02T10:00:00+03:00"
}
⚠️

YouTube default privacy is private. Set "privacy": "public" explicitly if you want the video publicly visible. See Assignments reference for the full payload schema per platform.

Test script — auto-save the returned assignment ID:

pm.test("Status is 201", () => {
    pm.response.to.have.status(201);
});
 
const body = pm.response.json();
pm.environment.set("assignment_id", body.id);
console.log("Saved assignment_id:", body.id);

Get assignment status

GET {{base_url}}/api/v1/assignments/{{assignment_id}}

Poll this until status is published, failed, or cancelled. See assignment lifecycle for all statuses.

Retry a failed assignment

POST {{base_url}}/api/v1/assignments/{{assignment_id}}/retry

Get platform capabilities

GET {{base_url}}/api/v1/platforms/youtube/capabilities

Returns the full payload schema for YouTube — field names, types, limits, and defaults. Call this before building a create_assignment request body. See Platform Capabilities reference.


Run with Newman (CLI)

Newman (opens in a new tab) is the Postman CLI runner. Use it for CI pipelines or automated smoke tests.

# Install
npm install -g newman
 
# Export your collection from Postman: Collection → ⋯ → Export → Collection v2.1
# Export your environment: Environments → ⋯ → Export
 
# Run
newman run delivery-api-collection.json \
  --environment delivery-api-environment.json \
  --reporters cli,json \
  --reporter-json-export results.json

Pass the API key as an environment variable instead of storing it in the exported file:

newman run delivery-api-collection.json \
  --environment delivery-api-environment.json \
  --env-var "api_key=$DELIVERY_API_KEY"

Troubleshooting

401 Unauthorized

  • Check that the active Postman environment contains api_key in Current value (not Initial value).
  • Make sure the collection Authorization tab is set to Bearer Token with {{api_key}}.

400 Bad Request on POST /assignments

  • Open the Response body — the details field lists the invalid fields.
  • Call GET /platforms/youtube/capabilities first to check required payload fields and allowed values.
  • Verify scheduledAt includes an explicit timezone offset, e.g. +03:00. A bare UTC string without offset is rejected.

Variables show as literal {{connection_id}}

  • No environment is active — select Pharlo from the environment dropdown (top-right).
  • Alternatively the variable is empty — run GET /connections first and let the test script populate it.

404 on imported requests

  • The spec may have been imported with the wrong base URL. Check the collection variables or environment for base_url.

See also