Manage stickers over the API
This guide walks through two tasks: making a sticker and saving it, and sending
one. Every path starts with /v1/accounts/{accountId}. The full list of routes and
fields is in the HTTP API reference. Reads need the
media scope. Changes and sends need send.
Prepare, review and save
-
Upload the image, GIF or video to
/uploadsas multipart form data. The response has anid; pass it assourceIdin the next step. Images and GIFs can be up to 64 MiB. Videos can be up to 512 MiB. -
Prepare the sticker. Send the
Idempotency-Keyheader with the request:{"sourceId": "SOURCE_ID", "maxEdge": 360, "fps": 12, "trim": {"startMs": 1000, "durationMs": 2000}}Field Use it to trimKeep one segment, in milliseconds fitShrink a larger image or GIF to fit the 1024-pixel sticker limit maxEdgeSet the longest edge, from 16 to 1024 pixels. It never enlarges. fpsSet the frame rate for a video source, from 1 to 30 The request returns
202with a job. PollGET /sticker-preparations/{id}until it completes. The result links to the original, a preview and sampled frames. -
Look at the preview and frames. If they are right, save the preparation:
{"source": {"kind": "prepared", "preparationId": "PREPARATION_ID"}}Send this as
POST /custom-stickerswith anIdempotency-Keyheader. To save a sticker you received instead, use{"kind": "message", "messageId": "MESSAGE_ID", "assetId": "ASSET_ID"}. Its original must already be downloaded and verified. -
When you no longer need the upload, delete it with
DELETE /uploads/{sourceId}. It returns{"released": true}. If a preparation or send still uses the upload, you get409 upload_in_useinstead.
Reorder and remove Saved stickers
PATCH /custom-stickers/{id} moves a sticker, and DELETE /custom-stickers/{id}
removes it from Saved. Both need an Idempotency-Key and an If-Match header with
the collection revision from your latest list read. Send {"position": {"afterId": "OTHER_ID"}} to move an item after another one. Use null to put it first.
A missing If-Match returns 428. A stale revision returns 412 with the current
revision. Read the list again and retry.
Send a selection
Send a sticker with POST /sends, using the same Idempotency-Key pattern as other
sends:
{ "kind": "sticker", "threadId": "CHAT_ID", "source": {"kind": "pack", "packId": "PACK_ID", "stickerId": "STICKER_ID"}}Use {"kind": "saved", "stickerId": "STICKER_ID"} to send from Saved, or
{"kind": "prepared", "preparationId": "PREPARATION_ID"} to send a preparation
directly. Sends revalidate the original first and keep GIF, PNG, JPEG and WXGF bytes in their original format. When a Saved sticker has no supported cached original, a send can fetch it from its CDN URL. A pack source must already be in the account’s added packs. Add a pack with
PUT /sticker-packs/{id}/membership. A send does not add the sticker to Saved.
Listen to the event stream for
sticker-collections.changed, and refresh the sticker picker when it arrives.
You do not need to poll the lists.