Amba

Content

Browse libraries, read today's scheduled content, and CRUD user-owned items.

Clients can read any library item (admin-authored content), author their own items within a library (rows stamped with owner_app_user_id = session user), and update / delete only the items they own.

Endpoints

MethodPathDescription
GET/client/content/today/:channelToday's scheduled item for the given channel.
GET/client/content/libraries/:libraryIdPaginated library browse.
POST/client/content/libraries/:libraryId/itemsCreate an item owned by the caller.
PATCH/client/content/items/:itemIdUpdate — only if owner_app_user_id matches the caller.
DELETE/client/content/items/:itemIdDelete — ownership-scoped.
GET/client/content/items/:itemIdFetch a single active item.

GET /client/content/today/:channel

Returns the single content item scheduled for today in the given channel. channel defaults to "default" in the SDK; pass the slug you gave your content library when creating it.

Response 200

{
  "data": {
    "id": "…",
    "channel": "default",
    "title": "…",
    "body": "…",
    "data": {},
    "published_at": "…",
    "user_state": {}
  }
}

Errors

  • 404 CONTENT_NOT_SCHEDULED — no item is scheduled for today in this channel.
  • 404 CONTENT_NOT_AVAILABLE — scheduled item is inactive or deleted.
  • 500 FETCH_FAILED.

Try it:

GET/client/content/today/default
client auth
curl -X GET 'https://api.amba.dev/v1/client/content/today/default'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X GET "${BASE_URL}/client/content/today/default" \
  -H "X-Api-Key: ${CLIENT_API_KEY}" \
  -H "Authorization: Bearer ${SESSION_TOKEN}"

GET /client/content/libraries/:libraryId

Paginated list of active items ordered by sort_order. :libraryId takes the library's id or its name.

Every item this router returns (library pages, single items, created and updated items) carries the SDKs' ContentItem fields next to its columns: channel (the library's name), data (the item's metadata), published_at (when it was created) and user_state ({}).

Query

ParamDefaultDescription
limit50
offset0
category—Optional filter.

Response 200

{
  "data": [
    {
      "id": "…",
      "library_id": "…",
      "title": "Hydrate",
      "body": "…",
      "metadata": { "minutes": 1 },
      "sort_order": 0,
      "created_at": "…",
      "channel": "Daily Tips",
      "data": { "minutes": 1 },
      "published_at": "…",
      "user_state": {}
    }
  ],
  "total": 42,
  "offset": 0,
  "limit": 50
}

Try it:

GET/client/content/libraries/%7B%7BlibraryId%7D%7D
client auth
curl -X GET 'https://api.amba.dev/v1/client/content/libraries/%7B%7BlibraryId%7D%7D'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X GET "${BASE_URL}/client/content/libraries/{libraryId}" \
  -H "X-Api-Key: ${CLIENT_API_KEY}" \
  -H "Authorization: Bearer ${SESSION_TOKEN}"

POST /client/content/libraries/:libraryId/items

Create an item with ownership stamped from the session user. sort_order is computed server-side via the shared advisory-lock helper (MAX+1 within the library). is_premium and is_active are not settable by clients.

Request

FieldTypeRequired
bodystringyes
titlestring | nullno
media_urlstring | nullno
categorystring | nullno
tagsstring[]no
metadataobjectno

Response 201

Full inserted row including id, owner_app_user_id, sort_order, is_active = true, plus the ContentItem fields.

Errors

  • 400 INVALID_INPUT — body missing or not JSON.
  • 404 NOT_FOUND — library does not exist.
  • 500 CREATE_FAILED.

Try it:

POST/client/content/libraries/%7B%7BlibraryId%7D%7D/items
client auth
curl -X POST 'https://api.amba.dev/v1/client/content/libraries/%7B%7BlibraryId%7D%7D/items' \
  -H 'Content-Type: application/json' \
  -d '{
  "body": "Drink a glass of water."
}'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X POST "${BASE_URL}/client/content/libraries/{libraryId}/items" \
  -H "X-Api-Key: ${CLIENT_API_KEY}" \
  -H "Authorization: Bearer ${SESSION_TOKEN}" \
  -H 'Content-Type: application/json' \
  -d '{"body":"Drink a glass of water."}'

PATCH /client/content/items/:itemId

Allowed fields: title, body, media_url, category, tags, metadata, is_active.

Ownership enforced in the UPDATE — zero rows affected → 404 NOT_FOUND whether the item doesn't exist or is owned by someone else (existence not leaked).

Errors

  • 400 INVALID_INPUT.
  • 404 NOT_FOUND.
  • 500 UPDATE_FAILED.

Try it:

PATCH/client/content/items/%7B%7BitemId%7D%7D
client auth
curl -X PATCH 'https://api.amba.dev/v1/client/content/items/%7B%7BitemId%7D%7D' \
  -H 'Content-Type: application/json' \
  -d '{
  "title": "Hydrate"
}'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X PATCH "${BASE_URL}/client/content/items/{itemId}" \
  -H "X-Api-Key: ${CLIENT_API_KEY}" \
  -H "Authorization: Bearer ${SESSION_TOKEN}" \
  -H 'Content-Type: application/json' \
  -d '{"title":"Hydrate"}'

DELETE /client/content/items/:itemId

Ownership-scoped; returns 404 NOT_FOUND on a miss without distinguishing the cause.

Response 200

{ "data": { "deleted": true } }

Errors

  • 404 NOT_FOUND.
  • 500 DELETE_FAILED.

Try it:

DELETE/client/content/items/%7B%7BitemId%7D%7D
client auth
curl -X DELETE 'https://api.amba.dev/v1/client/content/items/%7B%7BitemId%7D%7D'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X DELETE "${BASE_URL}/client/content/items/{itemId}" \
  -H "X-Api-Key: ${CLIENT_API_KEY}" \
  -H "Authorization: Bearer ${SESSION_TOKEN}"

GET /client/content/items/:itemId

Returns the item, with the ContentItem fields, only if it's is_active = true.

Errors

  • 404 NOT_FOUND.
  • 500 FETCH_FAILED.

Try it:

GET/client/content/items/%7B%7BitemId%7D%7D
client auth
curl -X GET 'https://api.amba.dev/v1/client/content/items/%7B%7BitemId%7D%7D'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X GET "${BASE_URL}/client/content/items/{itemId}" \
  -H "X-Api-Key: ${CLIENT_API_KEY}" \
  -H "Authorization: Bearer ${SESSION_TOKEN}"