Developer overview Manage API keys

Connect your shelter software

When an intake photo is ready, submit it from your server or an automation with an HTTP request step. Tomorrow’s Tail returns a job ID immediately. When the job finishes, your integration can attach the original and labeled AI portrait to the dog’s record. The same pair appears in the shelter’s Saved portraits.

1. Create a workspace key

In Shelter studio, open Integrations. Use Generate and read for intake workflows or Read only to import portraits staff create in the studio. Copy the key once and store it in your automation’s secret settings. Send it on every request using Authorization: Bearer YOUR_KEY. The key belongs on your integration server.

2. Submit the photograph

Send JSON to POST /api/v1/portraits. Use the dog’s name, an optional note describing visible temporary concerns, and the photo as a base64 JPEG or PNG data URL (5 MB maximum before encoding). The photo and note go to our AI image service for generation. Supply a stable Idempotency-Key for this intake event or photo revision.

POST /api/v1/portraits
Authorization: Bearer YOUR_KEY
Content-Type: application/json
Idempotency-Key: intake-A833997-photo-v1

{
  "name": "Cedrick",
  "note": "Patchy fur on the forehead",
  "photo": "data:image/jpeg;base64,<complete JPEG bytes in base64>"
}

For a client that can keep a request open for at least 130 seconds, add Prefer: wait=120 to process generation during that request. The response contains the same job object. Retry with the same event ID if the connection drops.

A new background job returns HTTP 202 and a relative status_url. If delivery is interrupted, send the same body and key again. All keys for a shelter share the same idempotency history. Reusing an event ID with different content returns HTTP 409.

3. Check the result

GET the status_url on the same host. While status is queued or processing, wait the number of seconds in Retry-After before checking again. When it is completed, GET the portrait_url. Save id on your animal record, alongside the images in photo and illustration and their labels. Keep the shelter photo and AI label together when sharing. The illustration depicts a possible appearance.

A failed job includes an error and is terminal. Inspect it before intentionally creating a new attempt with a new event ID. Each accepted job reserves one generation from the same daily limits as the studio. Queued jobs survive restarts. A job interrupted during a provider call is marked failed to avoid a duplicate charge.

Import existing portraits

GET /api/v1/portraits?after_id=0 returns up to 50 summaries in ascending ID order. Use next_after_id to fetch further pages. Save the highest processed ID for your next sync. Retrieve each pair with GET /api/v1/portraits/{id}. This includes portraits created in the staff studio.

Withdraw retired or deleted cards

Retired portraits disappear from active lists and item retrieval. A restored portrait keeps its original ID. Alongside the portrait import cursor, poll GET /api/v1/portrait-changes?after_id=0 for lifecycle events. Store the highest event ID you have processed. Each event includes its portrait_id, an action (retired, restored, or deleted) and a Unix timestamp in at. Remove withdrawn cards from your own listings. Previously downloaded files remain with their recipients. On restoration, fetch the current portrait by ID.

Access and errors

HTTP 401 means the key is missing, invalid, or revoked. HTTP 403 means the key lacks generation access. HTTP 404 means the item is unavailable in this shelter. HTTP 400, 413 and 415 indicate invalid input, excessive size and incorrect content type. HTTP 429 means the daily generation limit is exhausted (resets at midnight UTC). HTTP 503 means generation needs server configuration. Error responses include an error message.

For rotation, create a replacement key, update the integration and then revoke the old key. Revocation blocks future requests immediately. Previously accepted jobs still finish.

OpenAPI specification