pushbag
Documentation

HTTP API

Publish channel messages and versioned artifacts over HTTP, with request fields, responses and retry rules.

On this page

Send a message with one POST. To publish a file, request an upload grant, PUT the bytes to storage, then finalize the upload. The API host is https://api.pushbag.dev. Examples use fictitious IDs, signed URLs and receipts. Shell examples for uploads use Bash, curl, jq and OpenSSL. Start with an existing report.html file.

Check the API host

GET / on the API host takes no parameters, credentials or request body. curl https://api.pushbag.dev/ returns 200 OK with the plain-text body OK. Use discovery to obtain capabilities. The same path on the ping host requires POST.

Discover the deployment

GET /.well-known/pushbag.json takes no arguments or credentials. Read it before selecting a host or preparing a file. The numeric values are deployment ceilings. The caller’s plan can impose lower limits.

curl --fail https://api.pushbag.dev/.well-known/pushbag.json

Example 200 response using default limits:

{
  "apiBaseUrl":"https://api.pushbag.dev",
  "pingBaseUrl":"https://ping.pushbag.dev",
  "webBaseUrl":"https://app.pushbag.dev",
  "artifactOriginTemplate":"https://{slug}.pushbag.dev",
  "supportedArtifactKinds":["html","image","video"],
  "maxHtmlBytes":20971520,"maxImageBytes":67108864,
  "maxVideoBytes":1073741824,"maxVideoDurationSeconds":900,
  "maxUserStorageBytes":2199023255552,"maxVersionsPerArtifact":500,
  "defaultVisibility":"private","authProviders":["google"]
}

Publish a channel message

Method and path on the ping host Equivalent API path Credentials Target
POST / POST /api/ping/ Required The credential owner’s Personal channel.
POST /:channelId POST /api/ping/:channelId Optional for public publishing Exact channel ID from the dashboard.

Send a key in Authorization: Bearer or x-pushbag-key. Restricted publishing requires a channel grant. Ping ignores cookies and rejects an invalid supplied key even on a public channel.

curl https://ping.pushbag.dev/ \
  -H "Authorization: Bearer $PUSHBAG_API_KEY" \
  -H 'Content-Type: application/json' -H 'Idempotency-Key: build-184' \
  --data-binary '{"title":"Build","message":"Checks passed","priority":4}'

curl https://ping.pushbag.dev/CHANNEL_ID \
  -H 'Content-Type: text/plain' --data-binary 'Build finished'

Both return 202 Accepted, for example:

{"id":"message-1","channelId":"personal-channel","receipt":"6a9e…"}

A receipt confirms storage. Device delivery happens afterward. Reuse the same idempotency header (up to 128 characters), channel and payload to retrieve the original result. Changing content under that key returns 409. Without a key each accepted request creates a message.

Message fields

The entire request body must fit in 16,384 bytes. A text body, a missing content type or curl’s default form content type supplies the message verbatim. For JSON use application/json. Unknown fields are rejected.

Name Type Required Limits and meaning
message string Yes Nonblank, at most 4,096 UTF-8 bytes.
title string No Up to 256 characters after trimming.
priority integer No 1 through 5, default 3.
tags string array No Up to 10 labels, each 1–64 characters after trimming.
markdown boolean No Default false. Enable Markdown display.
click string No HTTP(S) or supported app link without credentials, up to 2,048 characters.
icon string No HTTP(S) image URL up to 2,048 characters.
actions object array No Up to three actions. Each needs an action type and a 1–64 character label.
data JSON object No Serialized size up to 4,096 bytes.
artifactVersionId string No Nonempty ID of an accessible artifact version.

A view action takes a destination with the same rules as click. A copy action takes a value of 1–2,048 characters.

{"message":"Build 184 is ready","actions":[{"action":"view","label":"Open build","url":"https://example.com/build/184"},{"action":"copy","label":"Copy ID","value":"184"}]}

Publish errors

Errors contain a machine-readable error and a human-readable message, for example {"error":"malformed_json","message":"The body is not valid JSON."}.

Status Error Cause
400 channel_required Anonymous publish omitted the channel ID.
400 malformed_json, invalid_payload, bad_request Invalid JSON, schema violation or oversized idempotency header.
401 unauthorized Missing credential on a restricted channel, or invalid supplied key.
403 forbidden Valid credential lacks publish access.
404 channel_not_found, artifact_not_found Unknown channel or inaccessible version.
404 not_found Extra segments on ping host. Body also includes the requested path.
405 method_not_allowed Ping host received a method other than POST.
409 idempotency_conflict Key already used for another message on this channel.
413 / 415 payload_too_large / unsupported_media_type Body exceeds 16 KiB or its media type is unsupported.
429 quota_exceeded, throttled Owner daily quota or anonymous rate limit reached.

Messages count against the channel owner’s daily allowance: 500 on Free, 5,000 on More and 20,000 on Even more. Anonymous publishes are also capped at 30 per IP per channel per minute.

Initiate a file upload

POST /api/uploads requires an artifact-capable credential. Include notify to request a pinned-version message when publication succeeds. For a restricted channel, use a Both key with a grant for that channel.

Name Type Required Limits and meaning
filename string Yes 1–512 characters.
kind enum Yes html, image or video.
contentType string Yes 1–255 characters. HTML: text/html. Images: PNG, JPEG, WebP, GIF, AVIF. Video: MP4 or WebM. Use the corresponding MIME type.
byteSize integer Yes Positive size of the exact bytes to upload. Plan and deployment ceilings apply.
checksumSha256 string Yes SHA-256 digest of those bytes, encoded as 44 base64 characters.
artifactId string No ID of an active artifact you own, same kind. Omit for a new artifact.
visibility enum No public or private. Defaults to deployment policy for new artifacts.
title, description strings No Up to 512 and 4,096 characters respectively.
expiresAt string No Future ISO datetime. Independent of activity.
retentionDays integer No Positive inactivity window within the account allowance.
cliVersion string No Up to 64 characters.
git object No Optional branch, repoHost, repoOrganization, repoName (255 chars each), commitSha (64), commitSubject (1,024), dirty (boolean).
ci object No Optional provider (64 chars), runUrl (1,024), actor (255).
notify object No Optional channelId, title, message and priority with the notification limits above. An empty object targets Personal.

Prepare the request from the file itself. Keep the response in a shell variable because it contains a signed storage URL.

api=https://api.pushbag.dev
digest=$(openssl dgst -sha256 -binary report.html | openssl base64 -A)
size=$(wc -c < report.html)
request=$(jq -n --arg digest "$digest" --argjson size "$size" \
  '{filename:"report.html",kind:"html",contentType:"text/html",byteSize:$size,
    checksumSha256:$digest,visibility:"private"}')
grant=$(curl --fail-with-body "$api/api/uploads" \
  -H "Authorization: Bearer $PUSHBAG_API_KEY" -H 'Content-Type: application/json' \
  --data-binary "$request")

Example 201 Created for a 56-byte file (signature and digest abbreviated):

{"uploadId":"upload-1","upload":{"method":"PUT","url":"https://storage.example/staging/file?signature=…","headers":{"content-type":"text/html","content-length":"56","x-amz-checksum-sha256":"Wm…="}},"expiresAt":"2026-12-01T12:15:00.000Z"}

A second initiation reserves another upload. Keep the first upload ID for retries. The server includes pending reservations when checking storage.

Transfer the bytes

PUT the returned upload.url with the returned headers and the original bytes. The storage signature authorizes this request. Keep the API key on the API host.

url=$(jq -r '.upload.url' <<<"$grant")
upload_id=$(jq -r '.uploadId' <<<"$grant")
curl --fail-with-body --request PUT "$url" --data-binary @report.html \
  -H 'Content-Type: text/html' -H "Content-Length: $size" \
  -H "x-amz-checksum-sha256: $digest"

The storage service’s successful response can have an empty body. Finalization publishes the stored bytes. If the PUT fails, check the size, digest and expiry before requesting another grant.

Finalize the upload

POST /api/uploads/:uploadId/complete with the same owner’s artifact credential. The only parameter is the upload ID in the path. Send no body.

curl --fail-with-body -X POST "$api/api/uploads/$upload_id/complete" \
  -H "Authorization: Bearer $PUSHBAG_API_KEY"

Example 200 OK:

{"artifact":{"id":"artifact-1","slug":"example","kind":"html","visibility":"private","url":"https://example.pushbag.dev"},"version":{"id":"version-1","versionNumber":1,"byteSize":56,"contentType":"text/html; charset=utf-8","durationMs":null,"url":"https://example.pushbag.dev/v/1"},"notification":null}

With notify, the notification field contains id, channelId and receipt. The server rechecks the target grant before finalizing. Retrying a completed session returns the stored publication. Two callers attempting finalization concurrently can receive a conflict. After a transient storage failure retry completion with the same upload ID.

Abandon the upload

DELETE /api/uploads/:uploadId releases a pending or uploaded session owned by the caller. Pass the artifact credential, the upload ID and no body.

curl -i -X DELETE "$api/api/uploads/$upload_id" \
  -H "Authorization: Bearer $PUSHBAG_API_KEY"

Success returns 204 No Content, with an empty body. A second deletion returns 409 once the session is expired. Abandoning a session already being validated also returns 409.

Upload errors

Status Operations Error body or code
400 Initiate bad_request for invalid fields or lifecycle. Schema failures include issues. A MIME type incompatible with the declared kind returns unsupported_content_type.
401 / 403 All API upload routes {"error":"unauthorized","message":"Authentication required."} or {"error":"forbidden","message":"This credential cannot manage artifacts."}
404 All not_found for an unowned or missing artifact or session.
409 Initiate kind_mismatch when appending another kind.
409 Complete, abandon conflict, e.g. {"error":"conflict","message":"This upload is already validating."}
410 Complete {"error":"expired","message":"This upload session has expired."}
413 Initiate kind_not_on_plan, file_too_large, version_limit_reached, artifact_limit_reached or quota_exceeded. The response also carries limit and actual when provided.
422 Complete Validation failed: object_missing, size_mismatch, size_over_limit, checksum_mismatch, unsupported_content, kind_mismatch, html_policy, duration_unverifiable or duration_over_limit. HTML rejections can include details.
503 Complete storage_unavailable. The server releases the validation claim so you can retry.

Initiation and completion can also return the channel errors above when notify is set. For CLI equivalents, see the command reference.

Last updated