Skip to main content

REST API

The plugins use the PostPin REST API, and you can use it too, for example to upload renders from a render farm or to sync markers with another tool.

Every PostPin server serves the API under /api/v1. It also ships its own interactive docs at /api/v1/docs and the OpenAPI spec at /api/v1/openapi.json. Neither needs a login.

The reference on this site lists every endpoint of the PostPin version these docs describe.

Authentication​

There are no API keys yet. The API accepts a PostPin session, either as the browser's session cookie or as a bearer token:

Authorization: Bearer <session token>

A token acts as the user it belongs to, with all their permissions. The API is the plugins' API, so like the plugins it needs the Member role or higher in the organization. For a reviewer it answers with 403 and a PluginRoleError that says so; GET /api/v1/projects does the same if the user is a reviewer in every organization. To get a token, sign in with email and password:

curl -s -X POST https://postpin.example.com/api/auth/sign-in/email \
-H 'Content-Type: application/json' \
-d '{"email": "you@example.com", "password": "YOUR_PASSWORD"}' \
| jq -r .token

The token is in the token field of the response and in the set-auth-token response header. Every token is a session, so it appears in the user's active sessions, where the user can also end it.

Uploading a render​

An upload goes through four steps. The file itself goes straight to the server's S3 storage in parts, not through the API.

  1. Create an export in a timeline: POST /api/v1/projects/{projectId}/timelines/{timelineId}/exports with {"nleProjectId": null, "nleTimelineId": null}. The two IDs link the export to a project and timeline in an editor. Pass null if there is none. An optional name (at most 100 characters) names the export; without it, the server names it.
  2. Start the upload: POST /api/v1/projects/{projectId}/timelines/{timelineId}/exports/{exportId}/init-upload with {"fileSize": <bytes>}. Announce the exact size: PostPin checks it against UPLOAD_MAX_FILE_SIZE and the storage quotas right away and answers with 413 if it doesn't fit. The response has a partSize and one presigned URL per part.
  3. Upload the parts: PUT each part's bytes to its URL and keep the ETag header of each response. The URLs are valid for 24 hours.
  4. Finish: POST /api/v1/projects/{projectId}/timelines/{timelineId}/exports/{exportId}/complete-upload with the uploadId, the list of {partNumber, etag} and a timelineSnapshot. PostPin then starts processing the file. If the parts add up to more than the announced size, the call fails with 413 and you have to start over.
warning

The review screen needs the timelineSnapshot to draw the timeline and place markers. Send at least the frame rate, the start frame and the duration, with an empty tracks list if you have nothing else. Every clip needs a color, null if it has none. See the TimelineSnapshot schema in the reference.

POST /api/v1/projects/{projectId}/timelines/{timelineId}/exports/{exportId}/abort-upload cancels an upload that you won't finish.

The plugins also upload the streaming versions they encoded, through proxies in init-upload and complete-upload, or through POST /api/v1/projects/{projectId}/timelines/{timelineId}/exports/{exportId}/init-proxy-uploads while the render is still uploading. You can leave them out: the server then encodes the streaming versions itself. complete-upload answers with transcodedBy, plugin or server.

API version​

GET /api/v1/config returns the server's API version (apiVersion), its release (serverRelease) and the transcoding mode. The plugins send their API version in the X-PostPin-Api-Version header, and the API answers with 426 if it differs from the server's. Requests without the header aren't checked.

Markers​

GET /api/v1/projects/{projectId}/timelines/{timelineId}/exports/{exportId}/markers returns the markers of an export with their replies.

PUT /api/v1/projects/{projectId}/timelines/{timelineId}/exports/{exportId}/markers adds or updates up to 2000 markers at once. Each marker needs a name, a frame and a categoryId. duration (in frames) makes it a range. New markers without one are point markers (0), existing ones keep theirs. To update existing markers, pass their PostPin id, or an nleId that you chose yourself. A marker with an nleId that PostPin already knows is updated, not added again. resolved: true closes a marker as done, false opens it again; left out, the marker stays as it is. Closed markers come back with resolvedAt set.

Marker frames are absolute timeline frames. At 24 fps, a timeline that starts at 01:00:00:00 begins at frame 86400. An export uploaded in the browser can start at another timecode than the timeline in your NLE: GET …/markers/origin says where its frames start and whether it came from the browser.

Markers deleted in PostPin are remembered: GET /api/v1/projects/{projectId}/timelines/{timelineId}/exports/{exportId}/markers/deleted lists them, so a sync doesn't bring them back.

The plugins sync through POST …/markers/sync and POST …/markers/links, and back up the markers before every change as marker sets (/api/v1/projects/{projectId}/timelines/{timelineId}/marker-sets), which their history restores. These endpoints follow the plugins' sync and are listed in the reference, but you won't need them for a simple import: use PUT …/markers.

Categories come from GET /api/v1/projects/{projectId}/categories. PUT on the same path creates one from {"name", "color"}, with the colour as #RRGGBB. "Done" can't be a category name (HTTP 400), because a #Done tag closes markers in the plugins. The markers of share link guests go into a "Guest" category, which PostPin creates with the first share link of a project.

What the API can't do yet​

The API has no endpoints for replies, renaming or deleting (except markers through the plugins' sync), members or invitations. Those only exist in the web app.

Reference​

The pages under Reference in the sidebar are generated from the server's OpenAPI spec.