You bring
A funded Account, a Workspace key, and an application server.
Documentation
Preview v0.1Learn how to authenticate, create generations, receive completion webhooks, manage Assets, handle billing, and use the API endpoints.
You bring
A funded Account, a Workspace key, and an application server.
Success means
You can submit a generation and retrieve its durable output Asset.
Base URL
https://api.tessarun.com/api/v1
01 · Concepts
TessaRun isolates infrastructure by Workspace. Your application still owns its users, authorization, workflow, and product-specific meaning.
Ownership map
One Account funds one or more isolated Workspaces.
Owns its Generations, Assets, webhook endpoints, and usage.
customer-42
Its Generations, Assets, and usage
project-red
A different resource group
Has its own resources and optional tenants. Its key receives 404 for Workspace A IDs.
TessaRun owns
Workspace isolation, durable operations and Assets, provider dispatch, signed webhook events, usage attribution, and prepaid charging.
Your application owns
Users, permissions, editorial state, workflow decisions, customer experience, and any billing of your downstream users.
A tenant is an optional identifier chosen by your application. It usually represents one of your customers, users, teams, or projects. For example, send
"tenant": "customer-42"
on that customer’s Generations and Assets. TessaRun returns the tenant on those resources, webhook events, and usage records, and list endpoints can filter by it.
Use tenant
to group many resources. Use metadata
to attach your own user, project, organization, or other identifiers to a resource. The Workspace API key still controls access; neither tenant nor metadata grants permission.
02 · Quickstart
Create and fund an Account, create a Workspace key, then run these requests from your server. The plaintext key is shown once.
Step 1 · Request
curl https://api.tessarun.com/api/v1/models \
-H "Authorization: Bearer $TESSARUN_API_KEY"
Step 1 · 200 OK · selected fields
{
"object": "list",
"data": [{
"id": "krea-2",
"name": "KREA 2",
"type": "image",
"capabilities": ["text_to_image"],
"availability": "preview",
"parameters": {
"prompt": {"type": "string", "required": true},
"aspect_ratio": {"type": "enum", "default": "4:5"},
"resolution": {"type": "enum", "default": "1.5k"}
}
}]
}
preview.
The model list can include models that are visible but do not accept generation requests yet. Read
GET /models/krea-2
for the complete parameter schema before building the request body.
Step 3 · Request
curl https://api.tessarun.com/api/v1/generations \
-H "Authorization: Bearer $TESSARUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "krea-2",
"tenant": "customer-42",
"params": {
"prompt": "A copper robot in a daylight studio",
"aspect_ratio": "4:5",
"resolution": "1.5k"
},
"metadata": {
"user_id": "user-42",
"project_id": "project-7",
"org_id": "org-3"
}
}'
Immediate response · 202 Accepted · selected fields
{
"id": "0190d9b8-7d31-7c0b-9aaa-4a0d0d2466ad",
"object": "generation",
"status": "pending",
"model": "krea-2",
"tenant": "customer-42",
"metadata": {
"user_id": "user-42",
"project_id": "project-7",
"org_id": "org-3"
},
"price": {"amount": 7, "currency": "usd", "unit": "cent"},
"assets": [],
"error": null,
"accepted_at": "2026-08-17T18:42:05Z",
"created_at": "2026-08-17T18:42:05Z"
}
Terminal response · 200 OK · selected fields
{
"id": "0190d9b8-7d31-7c0b-9aaa-4a0d0d2466ad",
"object": "generation",
"status": "succeeded",
"model": "krea-2",
"price": {"amount": 7, "currency": "usd", "unit": "cent"},
"assets": [{
"id": "0190d9c1-46ba-78be-8123-6d40462e26bd",
"object": "asset",
"status": "ready",
"media_kind": "image",
"mime_type": "image/png"
}],
"error": null,
"finished_at": "2026-08-17T18:42:41Z"
}
Status check
GET /generations/0190d9b8-...
After a completion webhook, read the generation to retrieve its full Asset or error details.
Download
GET /assets/0190d9c1-.../download
The response contains a short-lived download URL. Treat that URL as a secret capability.
03 · Request fields
Authentication, attribution, and application metadata serve different purposes.
| Value | Job | Scope | Do not use it for |
|---|---|---|---|
Workspace key |
Authentication and resource isolation | One Workspace | A downstream browser or mobile session |
tenant |
Groups many resources for one customer, user, team, or project | Reusable inside one Workspace | Authorization, authentication, or a separate balance |
metadata |
Your identifiers and other structured context, returned unchanged | Stored on a resource | Indexed lookup, trust decisions, or billing |
tenant
accepts at most 255 characters. metadata
must be a JSON object and accepts at most 32,000 encoded bytes per resource.
04 · Generations
A generation moves forward through managed work. Your request connection may end; the generation continues until a terminal state.
Validation, price fixation, operation creation, debit, and accepted event commit together.
TessaRun materializes output as a durable ready Asset and records successful usage.
TessaRun records a stable error and fully refunds the accepted charge.
05 · Assets
A URL is read for one generation. An Asset is a durable, Workspace-scoped media resource that can be reused and downloaded later.
Use asset_id when
"image": {"asset_id": "0190..."}
Use url when
"image": {"url": "https://..."}
Direct upload sequence
POST /assets
Receive the pending Asset and short-lived PUT URL.
PUT signed_url
Upload bytes directly to object storage.
POST /assets/:id/complete
TessaRun verifies the object and marks it ready.
asset_id or /download
Reference it in work or request a short-lived GET URL.
Ready means usable.
A generation input must reference a ready
Asset of the correct media kind in the same Workspace. A temporary URL input does not create an Asset. Keep upload and download URLs out of logs because possession grants temporary access.
06 · Webhooks
Register an HTTPS endpoint and select the generation event types your application needs. TessaRun sends each selected event to that endpoint.
Register an endpoint
curl https://api.tessarun.com/api/v1/webhook_endpoints \
-H "Authorization: Bearer $TESSARUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://app.example.com/webhooks/tessarun",
"event_types": [
"generation.succeeded",
"generation.failed"
]
}'
201 Created · selected fields
{
"id": "0190da31-75b6-742d-93eb-4907d32d2c15",
"object": "webhook_endpoint",
"url": "https://app.example.com/webhooks/tessarun",
"event_types": [
"generation.failed",
"generation.succeeded"
],
"status": "active",
"signing_secret": "whsec_..."
}
The signing secret is returned only when the endpoint is created or its secret is rotated. An empty
event_types
array subscribes the endpoint to every available type.
Verify every delivery
webhook-timestamp
values more than five minutes from the current time.
Signed HTTP POST
{
"id": "0190da43-ddc4-79f5-b78e-e011866a78cc",
"object": "event",
"type": "generation.succeeded",
"operation_id": "0190d9b8-7d31-7c0b-9aaa-4a0d0d2466ad",
"tenant": "customer-42",
"data": {
"id": "0190d9b8-7d31-7c0b-9aaa-4a0d0d2466ad",
"status": "succeeded",
"model": "krea-2",
"price_cents": 7
},
"metadata": {
"user_id": "user-42",
"project_id": "project-7",
"org_id": "org-3"
},
"occurred_at": "2026-08-17T18:42:41Z"
}
Deliveries include webhook-id, webhook-timestamp, and webhook-signature. The signed content is
webhook-id.webhook-timestamp.raw_body
using HMAC-SHA256 and the endpoint secret. After a terminal event, use
GET /generations/:generation_id
once to retrieve the complete output Assets or failure details.
07 · Billing
The parent Account holds the prepaid balance shared by its Workspaces. A Workspace key can read only that Workspace’s resources, successful usage, and attributed ledger entries.
TessaRun charges the price returned with the accepted generation response.
Successful work appears in /usage
with tenant and metadata attribution.
Failed work does not create a successful usage record.
GET /usage
Returns the current shared Account prepaid balance plus successful usage attributed to this Workspace.
GET /balance_transactions
Returns immutable charges and refunds attributed to this Workspace. Account funding and sibling Workspace entries stay excluded.
08 · Errors
Error bodies use error.type, an optional human message, and optional details. Provider and database internals do not cross the public boundary.
{
"error": {
"type": "validation_error",
"details": [{
"field": "prompt",
"message": "must be at most 20000 encoded bytes"
}]
}
}
| Status | Typical meaning | Your action |
|---|---|---|
401 |
Missing, invalid, expired, inactive, or blocked key | Stop and repair credentials or Account state. |
402 |
Insufficient funds or past-due Account | Add funds, then submit the work. |
404 |
Unknown ID or ID owned by another Workspace | Check the ID and authenticated Workspace. |
422 |
Validation, model, or media-input error | Correct the request before submitting a new generation. |
Use the HTTP status and error.type
for program logic. Use the OpenAPI document for the wire-level response schema.
09 · Reference
This endpoint index belongs to the workflow explained above. The OpenAPI 3.1 document remains the canonical source for request and response schemas.
/models
List discoverable logical models.
/models/{model_id}
Read one model and its current parameter schema.
/generations
List recent Workspace generations.
/generations
Validate, price, debit, and submit managed work.
/generations/{generation_id}
Read current state, price, errors, and output Assets.
/assets
List durable Workspace Assets.
/assets
Create a pending Asset and direct upload request.
/assets/{asset_id}
Read one Asset in the authenticated Workspace.
/assets/{asset_id}/complete
Verify the stored object and mark the Asset ready.
/assets/{asset_id}/download
Create a short-lived direct download URL.
/webhook_event_types
List the available webhook event types.
/webhook_endpoints
List Workspace webhook endpoints.
/webhook_endpoints
Register an HTTPS destination and receive its signing secret.
/webhook_endpoints/{webhook_endpoint_id}
Read one Workspace webhook endpoint.
/webhook_endpoints/{webhook_endpoint_id}
Change the URL, event selection, description, or status.
/webhook_endpoints/{webhook_endpoint_id}
Delete a webhook endpoint.
/webhook_endpoints/{webhook_endpoint_id}/rotate_secret
Replace the endpoint signing secret.
/usage
Read successful usage and the shared prepaid balance.
/balance_transactions
List Workspace-attributed charges and refunds.
10 · Operations
Follow these practices when storing credentials, handling webhook events and media, and reconciling usage.
Keep Workspace keys on the server and out of client bundles, logs, and transcripts.
Separate environments with separate Workspaces when independent isolation is useful.
Persist every returned generation ID beside your own job or resource record.
Subscribe to generation.succeeded
and generation.failed, then handle both.
Verify webhook timestamps and signatures against the exact raw request body.
Use ready Assets for durable or reusable media; keep signed URLs out of logs.
Authorize downstream users in your application; use tenant
only for attribution.
Handle 401, 402, 404, and 422 responses explicitly.
Monitor prepaid balance and reconcile usage and ledger entries by Workspace.
Pin integration tests to OpenAPI and the exact endpoint behavior you depend on.