Trails REST API
The /v1 API behind the MCP tools, for agents you build and for scripts.
The base URL is https://api.joring.ai/v1. Send
Authorization: Bearer jor_api_... with every request (see
API keys). The OpenAPI document at
https://api.joring.ai/openapi.json
lists every route and every schema.
Quick start
Read the guide
curl -H "Authorization: Bearer $JORING_API_KEY" \
https://api.joring.ai/v1/authoring-guideIt returns the rules, the field limits, the supported AI tools, the trails that already exist, and the JSON Schema for a trail document. It has the same content as the authoring guide.
Create a draft
curl -X POST -H "Authorization: Bearer $JORING_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"document": { ... }}' \
https://api.joring.ai/v1/trailsThe response is 201 with the trail, an ETag header (the trail's revision)
and a Location header. In the body, publish_issues lists what still blocks
publishing.
Save changes
curl -X PUT -H "Authorization: Bearer $JORING_API_KEY" \
-H "Content-Type: application/json" \
-H 'If-Match: "1"' \
-d '{ ...the full document... }' \
https://api.joring.ai/v1/trails/{id}/documentIf-Match is required. It names the revision that you edited. If someone else
saved in the meantime, you get 412 with current_revision. Load the trail
again and apply your change again.
Run the examples, then publish
curl -X POST -H "Authorization: Bearer $JORING_API_KEY" \
https://api.joring.ai/v1/trails/{id}/run-examples
curl -X POST -H "Authorization: Bearer $JORING_API_KEY" \
https://api.joring.ai/v1/trails/{id}/publishPublishing needs the trails:publish scope. If the trail is not ready, Joring
refuses with 422 and an issues list.
Routes
| Method and path | Scope | |
|---|---|---|
GET /me | any | Who the key acts as, its team and its scopes |
GET /authoring-guide | read | Rules, limits, tools, existing trails, document schema |
GET /trails | read | List; status, q, limit (≤ 100), cursor |
POST /trails | write | Create a draft |
GET /trails/{id} | read | The trail with its document and publish_issues; honors If-None-Match |
PATCH /trails/{id} | write | visibility (all_teams or restricted), sort_order |
DELETE /trails/{id} | write, and publish for a live trail | Delete the trail and its versions |
GET /trails/{id}/document | read | The stored draft; ETag is the revision |
PUT /trails/{id}/document | write | Replace the draft; If-Match is required |
POST /trails/{id}/publish | publish | Make it live |
POST /trails/{id}/unpublish | publish | Take it back to draft |
POST /trails/{id}/archive, .../unarchive | publish | Hide it from the catalog, or show it again |
GET /trails/{id}/versions, GET .../versions/{v} | read | Published snapshots |
POST /trails/{id}/versions/{v}/restore | write | Put a snapshot back in the draft |
GET /trails/{id}/grants, POST .../grants, DELETE .../grants/{user_id} | read / write | Who can see a restricted trail ({"email": ...}; the person must be a member) |
POST /trails/{id}/surfacing-test | write | {"draft_text": ..., "document"?: ...} |
POST /trails/{id}/run-examples | write | Run every trigger example and store the summary |
POST /content-assets | write | Multipart file (PNG, JPEG, WebP or GIF, up to 10 MB). Returns Markdown for the setup guide. The image URL is signed for one hour. The saved document keeps the bare URL, and every document the API returns carries fresh signatures |
Conventions
Errors use the RFC 9457 format, application/problem+json. The type is
https://api.joring.ai/problems/{slug}. Compare the slug, not the title.
| Status | Slug | |
|---|---|---|
| 400 | bad-request | A parameter or the body is malformed |
| 401 | unauthorized | The key is missing, wrong, revoked or expired |
| 402 | upgrade-required | The plan does not include API access |
| 403 | insufficient-scope | The key lacks the scope named in required_scope |
| 403 | membership-revoked, forbidden | See API keys |
| 404 | not-found | No such trail in this team |
| 409 | conflict, idempotency-in-flight | The trail's state does not allow the action, or a retry arrived while the first request is still running |
| 412 | revision-conflict | The If-Match value is out of date; current_revision gives the current one |
| 413 | payload-too-large | The uploaded image is larger than the limit |
| 415 | unsupported-media-type | The uploaded file is not a PNG, JPEG, WebP or GIF image |
| 422 | validation, unprocessable, idempotency-key-mismatch | issues lists the fields to fix; or a rule refused the action; or the idempotency key was already used for a different request |
| 423 | team-pending-deletion | The team is scheduled for deletion |
| 428 | precondition-required | PUT .../document was sent without If-Match |
| 429 | Too many requests; see Rate limits below | |
| 503 | service-unavailable | The image could not be stored right now; try again later |
Concurrency. The ETag on a trail response is the revision, in quotes
("7"). PUT .../document needs If-Match with that value, or * to
overwrite whatever is there.
Idempotency. Send Idempotency-Key on POST, PUT, PATCH and DELETE. The
key is any string of up to 255 characters, unique for each request. If you
retry with the same key and body within 24 hours, Joring returns the original
response again, with Idempotent-Replayed: true.
Pagination. GET /trails returns items and next_cursor. To get the
next page, send the cursor back. Cursors are opaque.
Rate limits apply to each key. Each limit is a burst of requests that refills one request at a fixed interval:
- Most routes: 120 in a burst, then one more each second.
- Routes that run a model (surfacing tests, run-examples, publish, document saves and restores): 10 in a burst, then one more every three seconds.
- Uploads: 20 in a burst, then one more every two seconds.
A 429 response carries retry-after with the seconds to wait, and
x-ratelimit-after, x-ratelimit-limit and x-ratelimit-remaining.
Request IDs. Every response carries Request-Id. Give it to support when
you contact them.
The rules that make a trail read well and surface at the right moment.