Docs menuPost labels

Post labels

GET /api/v1/labels

The user's post labels (the app's tags), by name: id, name, color, with the palette (colors, default_color) and limit. Free.

  • Scopepostory:read
  • Limit classREAD
  • Success200

Example

Request
curl https://postory.io/api/v1/labels \
  -H "Authorization: Bearer $POSTORY_API_KEY"
Response 200
{
  "labels": [{"id": "<label_id>", "name": "Launch", "color": "spot"}],
  "count": 1,
  "colors": [
    "idle",
    "ink",
    "spot",
    "spot-2",
    "run",
    "wait",
    "block",
    "surface-lavender",
    "surface-mint",
    "surface-sage",
    "surface-blush"
  ],
  "default_color": "idle",
  "limit": 50,
  "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/labels

Create a label (50 at most: 409 label_limit_reached; a name the user already has: 409 label_name_taken with that label's label_id). Idempotency-Key replays the first answer for 24 hours.

  • 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
color"idle" | "ink" | "spot" | "spot-2" | "run" | "wait" | "block" | "surface-lavender" | "surface-mint" | "surface-sage" | "surface-blush"

A palette token: idle gray (the default), ink black, spot lime, spot-2 teal, run green, wait amber, block red, surface-lavender purple, surface-mint dark green, surface-sage gray-green, surface-blush brick.

namerequiredstring

1 to 40 characters, unique among the user's labels (any case).

Up to 40 characters

Example

Request
curl https://postory.io/api/v1/labels \
  -H "Authorization: Bearer $POSTORY_API_KEY" \
  -H "Idempotency-Key: <unique-key>" \
  -H "Content-Type: application/json" \
  -d '{"name": "Launch", "color": "spot"}'
Response 201
{
  "label": {"id": "<label_id>", "name": "Launch", "color": "spot"},
  "created": 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

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

PATCH /api/v1/labels/{label}

Rename and/or recolour a label; only what is sent changes. Unknown: 404 not_found listing the user's labels.

  • Scopepostory:drafts
  • Limit classWRITE
  • Success200

Parameters

NameInTypeDescription
labelrequiredpathstring

A label's id from GET /labels, or its name (any case).

Up to 40 characters

Request body

FieldTypeDescription
color"idle" | "ink" | "spot" | "spot-2" | "run" | "wait" | "block" | "surface-lavender" | "surface-mint" | "surface-sage" | "surface-blush"

A palette token: idle gray (the default), ink black, spot lime, spot-2 teal, run green, wait amber, block red, surface-lavender purple, surface-mint dark green, surface-sage gray-green, surface-blush brick.

namestring

1 to 40 characters, unique among the user's labels (any case).

Up to 40 characters

Example

Request
curl -X PATCH "https://postory.io/api/v1/labels/<label>" \
  -H "Authorization: Bearer $POSTORY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"color": "idle"}'
Response 200
{
  "label": {"id": "<label_id>", "name": "Launch week", "color": "run"},
  "created": false,
  "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/labels/{label}

Delete a label: it leaves every post that carried it (removed_from_posts counts them); the posts stay.

  • Scopepostory:drafts
  • Limit classDELETE
  • Success200

Parameters

NameInTypeDescription
labelrequiredpathstring

A label's id from GET /labels, or its name (any case).

Up to 40 characters

Example

Request
curl -X DELETE "https://postory.io/api/v1/labels/<label>" \
  -H "Authorization: Bearer $POSTORY_API_KEY"
Response 200
{
  "id": "<label_id>",
  "name": "Launch",
  "color": "spot",
  "deleted": true,
  "removed_from_posts": 3,
  "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