Skip to content

Build an installed tool

Developer reference for the device authorization flow, file upload sequence, and sprite sheet metadata.

Device authorization

Installed clients use the OAuth 2.0 device authorization grant. Send form data, honor the returned polling interval, and keep credentials out of URLs and logs.

Request a device code

Shell
curl -X POST https://projectfeed.app/oauth/device/authorization \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "client_id=project-feed-unreal" \
  --data-urlencode "device_name=Jordan’s workstation" \
  --data-urlencode "scope=projects:read posts:write tasks:write media:write"

The response includes device_code, a displayable user_code, verification_uri, verification_uri_complete, expires_in, and interval. Use the fixed client scopes shown above; unknown scopes are rejected.

Poll for approval

Shell
curl -X POST https://projectfeed.app/oauth/device/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "grant_type=urn:ietf:params:oauth:grant-type:device_code" \
  --data-urlencode "device_code=pfd_..." \
  --data-urlencode "client_id=project-feed-unreal"

Poll no faster than interval. Continue after authorization_pending, add five seconds after slow_down, and stop after access_denied or expired_token.

Refresh the connection

Shell
curl -X POST https://projectfeed.app/oauth/device/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "grant_type=refresh_token" \
  --data-urlencode "refresh_token=pfr_..." \
  --data-urlencode "client_id=project-feed-unreal"

Access tokens last one hour. Each refresh returns a new access token and refresh token; replace both stored values together. The refresh family expires 30 days after approval. Reusing an older refresh token revokes the active family and requires a new connection.

Publish a file through the API

Send both headers below on every workspace API and upload request. A token cannot switch to another workspace by changing the header. Workspace API requests use https://projectfeed.app. Upload requests use https://api.projectfeed.app.

HTTP
Authorization: Bearer <access_token>
X-Project-Feed-Workspace: <workspace_slug>
Content-Type: application/json
  1. 1.

    Create a post

    POST https://projectfeed.app/api/v1/posts with the selected project, title, content, and draft or published status.

  2. 2.

    Reserve storage

    Use https://api.projectfeed.app/api/upload/request for files and audio, https://api.projectfeed.app/api/upload/images-request for images, or https://api.projectfeed.app/api/upload/stream-request for video.

  3. 3.

    Upload and confirm

    Upload through the returned provider URL, then call the matching confirm endpoint with the server-owned upload or reservation fields. Keep the mediaBlobId and dedupConfirmationKey returned by that verified confirmation.

  4. 4.

    Attach the confirmed upload

    POST https://projectfeed.app/api/v1/media/direct with the post ID and canonical metadata returned by the upload flow. When mediaBlobId is present, send the dedupConfirmationKey returned with it. The API consumes that proof once before creating the attachment.

  5. 5.

    Save the source identity

    PUT https://projectfeed.app/api/v1/tool-artifacts so the next publish can find the same source artifact. The provider and external artifact ID form a stable identity that cannot move to another project. See the tool artifact reference for the request body and limits.

Sprite sheet metadata

A sprite attachment carries its grid in spriteSheetData. Send frameWidth, frameHeight, frameCount, columns, rows, and framerate. The remaining fields are optional. A sheet whose frames do not sit on a uniform grid can add frameRects, and columns and rows still describe its rough layout.

HTTP
POST https://projectfeed.app/api/v1/media/direct

{
  "postId": "<post_id>",
  "fileName": "hero-run.png",
  "fileType": "sprite",
  "fileSize": 24576,
  "width": 134,
  "height": 68,
  "spriteSheetData": {
    "frameWidth": 32,
    "frameHeight": 32,
    "frameCount": 8,
    "columns": 4,
    "rows": 2,
    "framerate": 12,
    "offsetX": 1,
    "offsetY": 1,
    "spacingX": 2,
    "spacingY": 2,
    "animations": [
      {
        "name": "Run",
        "frames": [0, 1, 2, 3],
        "direction": "pingpong",
        "colorIndex": 2
      }
    ]
  }
}
  • offsetX and offsetY skip padding before the first frame. spacingX and spacingY are the gutters between frames. All four are whole numbers of 0 or more, and an offset cannot push the first frame off the sheet.
  • frameRects lists one source rect per frame in sheet pixels and in playback order, and its length must match frameCount. A sheet carries at most 1,024 rects, each with a whole-number x, y, width, and height that stays inside the declared width and height. The request body is capped at 64 KB, so a sheet near the rect limit has little room left for frameDurations and animations.
  • frameDurations holds one duration in milliseconds per frame and must match frameCount. Send hasVariableFramerate when the sheet does not run at a single rate.
  • Each entry in animations lists frame indexes below frameCount. direction accepts forward, reverse, or pingpong. colorIndex selects the swatch shown next to the animation.

Credential storage

  • Store access and refresh tokens in the operating system credential store, never in a project file, editor preference export, command line, or log.
  • Serialize refreshes so two editor processes cannot rotate the same refresh token at once.
  • Discard credentials after access_denied, expired_token, or invalid_grant and ask the user to reconnect.
  • A removed member, downgraded workspace, revoked token, or refresh-token reuse stops future publishing without changing existing posts and attachments.

Fix API problems

The client receives slow_down
Add five seconds to the polling interval and continue only until the device code expires. Parallel polling from more than one process makes recovery less predictable.
The approval code expired
Start a new device authorization. Do not continue polling or reuse a device code after expired_token.
Refresh returns invalid_grant
Discard the access and refresh tokens together and reconnect. Reusing an older rotated refresh token revokes the active refresh family.
A request returns 401 or 403
For 401, refresh once or reconnect if refresh fails. For 403, check the member role, project access, fixed client scopes, workspace plan, personal API token policy, and selected workspace header.
The upload succeeds but the attachment is missing
Keep the canonical confirmed upload response and retry the attachment step without uploading a second file. If confirmation did not complete, start a new upload request and provider transfer before confirming again.
An artifact maps to the wrong project
An existing provider and external artifact ID cannot move between projects. Use a new stable external artifact ID for the intended project.

Next steps

Image preview
100%