Docs menuBrand kit

Brand kit

GET /api/v1/brand-kit

Every brand kit item of the user, in their order: id, slug, name, text in full and images (with kept_from_auto_delete true: the media library's cleanup never deletes it; an image whose file was deleted is available false with neither it nor a url). Free.

  • Scopepostory:read
  • Limit classREAD
  • Success200

Example

Request
curl https://postory.io/api/v1/brand-kit \
  -H "Authorization: Bearer $POSTORY_API_KEY"
Response 200
{
  "items": [
    {
      "id": "<item_id>",
      "slug": "our-product",
      "name": "Our product",
      "text": "Acme, a scheduling app for small teams",
      "images": [
        {
          "asset_id": "<asset_id>",
          "url": "https://media.example.com/logo.png",
          "width": 1024,
          "height": 1024,
          "alt_text": "Acme logo",
          "available": true,
          "kept_from_auto_delete": true
        }
      ]
    }
  ],
  "count": 1,
  "limit": 100,
  "brand_kit_url": "https://postory.io/settings/brand-kit",
  "acting_as": {"postory": "[email protected]", "plan": "free"}
}

Other responses

401

No API key, or an invalid or revoked one

403

The key lacks the scope, or access is paused

422

A request parameter is not valid

429

Rate limit spent; see Retry-After

POST /api/v1/brand-kit

Create a brand kit item: a text, up to 3 library images, or both (100 items at most: 409 conflict with limit; a slug the user already has: 409 conflict with slug; a file that is no image of the user's library: 404 media_not_found). Idempotency-Key replays the first answer for 24 hours, so a retry makes no second item.

  • Scopepostory:drafts
  • Limit classWRITE
  • Success201

Parameters

NameInTypeDescription
Idempotency-Keyheaderstring

Any unique string (1-255 characters). The first answer for this key is replayed for 24 hours (Idempotent-Replayed: true) without running anything again; the same key with a different request is 409 idempotency_conflict.

Up to 255 characters

Request body

FieldTypeDescription
asset_idsstring[]

Images' ids from GET /media-library?type=image, in order.

Up to 3 items
namerequiredstring

What the user calls it.

Up to 80 characters
slugstring

Kebab-case, a letter first (brand-name), unique among the user's items: $brand-name in a message, a preset or a skill stands for the item. Omitted on create: from the name.

Up to 65 characters
textstring

What $slug is replaced with. An item has a text, an image, or both.

Up to 2000 characters

Example

Request
curl https://postory.io/api/v1/brand-kit \
  -H "Authorization: Bearer $POSTORY_API_KEY" \
  -H "Idempotency-Key: <unique-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Our product",
    "slug": "our-product",
    "text": "Acme, a scheduling app for small teams",
    "asset_ids": ["<image id from media library>"]
  }'
Response 201
{
  "item": {
    "id": "<item_id>",
    "slug": "our-product",
    "name": "Our product",
    "text": "Acme, a scheduling app for small teams",
    "images": [
      {
        "asset_id": "<asset_id>",
        "url": "https://media.example.com/logo.png",
        "width": 1024,
        "height": 1024,
        "alt_text": "Acme logo",
        "available": true,
        "kept_from_auto_delete": true
      }
    ]
  },
  "created": true,
  "brand_kit_url": "https://postory.io/settings/brand-kit",
  "acting_as": {"postory": "[email protected]", "plan": "free"}
}

Other responses

401

No API key, or an invalid or revoked one

403

The key lacks the scope, or access is paused

404

Not found, or not this user's

409

The state does not allow it now (already scheduled, changed, needs a choice…); branch on code

422

A request parameter is not valid

429

Rate limit spent; see Retry-After

GET /api/v1/brand-kit/{item}

One item by its id or slug, with the same fields. 404 not_found lists the user's items (id, slug, name). Free.

  • Scopepostory:read
  • Limit classREAD
  • Success200

Parameters

NameInTypeDescription
itemrequiredpathstring

An item's id from GET /brand-kit, or its slug.

Up to 65 characters

Example

Request
curl "https://postory.io/api/v1/brand-kit/<item>" \
  -H "Authorization: Bearer $POSTORY_API_KEY"
Response 200
{
  "item": {
    "id": "<item_id>",
    "slug": "our-product",
    "name": "Our product",
    "text": "Acme, a scheduling app for small teams",
    "images": [
      {
        "asset_id": "<asset_id>",
        "url": "https://media.example.com/logo.png",
        "width": 1024,
        "height": 1024,
        "alt_text": "Acme logo",
        "available": true,
        "kept_from_auto_delete": true
      }
    ]
  },
  "brand_kit_url": "https://postory.io/settings/brand-kit",
  "acting_as": {"postory": "[email protected]", "plan": "free"}
}

Other responses

401

No API key, or an invalid or revoked one

403

The key lacks the scope, or access is paused

404

Not found, or not this user's

422

A request parameter is not valid

429

Rate limit spent; see Retry-After

PATCH /api/v1/brand-kit/{item}

Change an item's name, slug, text or images; only what is sent changes. An image the item already holds may stay after its file was deleted.

  • Scopepostory:drafts
  • Limit classWRITE
  • Success200

Parameters

NameInTypeDescription
itemrequiredpathstring

An item's id from GET /brand-kit, or its slug.

Up to 65 characters

Request body

FieldTypeDescription
asset_idsstring[]

Images' ids from GET /media-library?type=image, in order. Replaces the item's; []: none.

Up to 3 items
namestring

What the user calls it.

Up to 80 characters
slugstring

Kebab-case, a letter first (brand-name), unique among the user's items: $brand-name in a message, a preset or a skill stands for the item. Omitted on create: from the name.

Up to 65 characters
textstring

What $slug is replaced with. An item has a text, an image, or both. "": no text.

Up to 2000 characters

Example

Request
curl -X PATCH "https://postory.io/api/v1/brand-kit/<item>" \
  -H "Authorization: Bearer $POSTORY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"asset_ids": ["<asset_ids>"]}'
Response 200
{
  "item": {
    "id": "<item_id>",
    "slug": "our-product",
    "name": "Our product",
    "text": "Acme, the scheduling app for teams of five",
    "images": [
      {
        "asset_id": "<asset_id>",
        "url": "https://media.example.com/logo.png",
        "width": 1024,
        "height": 1024,
        "alt_text": "Acme logo",
        "available": true,
        "kept_from_auto_delete": true
      }
    ]
  },
  "created": false,
  "brand_kit_url": "https://postory.io/settings/brand-kit",
  "acting_as": {"postory": "[email protected]", "plan": "free"}
}

Other responses

401

No API key, or an invalid or revoked one

403

The key lacks the scope, or access is paused

404

Not found, or not this user's

409

The state does not allow it now (already scheduled, changed, needs a choice…); branch on code

422

A request parameter is not valid

429

Rate limit spent; see Retry-After

DELETE /api/v1/brand-kit/{item}

Delete an item, permanently; its images stay in the media library.

  • Scopepostory:drafts
  • Limit classDELETE
  • Success200

Parameters

NameInTypeDescription
itemrequiredpathstring

An item's id from GET /brand-kit, or its slug.

Up to 65 characters

Example

Request
curl -X DELETE "https://postory.io/api/v1/brand-kit/<item>" \
  -H "Authorization: Bearer $POSTORY_API_KEY"
Response 200
{
  "id": "<item_id>",
  "slug": "our-product",
  "name": "Our product",
  "deleted": true,
  "acting_as": {"postory": "[email protected]", "plan": "free"}
}

Other responses

401

No API key, or an invalid or revoked one

403

The key lacks the scope, or access is paused

404

Not found, or not this user's

422

A request parameter is not valid

429

Rate limit spent; see Retry-After