Skip to Content
Joring Docs
Developers

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-guide

It 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/trails

The 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}/document

If-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}/publish

Publishing needs the trails:publish scope. If the trail is not ready, Joring refuses with 422 and an issues list.

Routes

Method and pathScope
GET /meanyWho the key acts as, its team and its scopes
GET /authoring-guidereadRules, limits, tools, existing trails, document schema
GET /trailsreadList; status, q, limit (≤ 100), cursor
POST /trailswriteCreate a draft
GET /trails/{id}readThe trail with its document and publish_issues; honors If-None-Match
PATCH /trails/{id}writevisibility (all_teams or restricted), sort_order
DELETE /trails/{id}write, and publish for a live trailDelete the trail and its versions
GET /trails/{id}/documentreadThe stored draft; ETag is the revision
PUT /trails/{id}/documentwriteReplace the draft; If-Match is required
POST /trails/{id}/publishpublishMake it live
POST /trails/{id}/unpublishpublishTake it back to draft
POST /trails/{id}/archive, .../unarchivepublishHide it from the catalog, or show it again
GET /trails/{id}/versions, GET .../versions/{v}readPublished snapshots
POST /trails/{id}/versions/{v}/restorewritePut a snapshot back in the draft
GET /trails/{id}/grants, POST .../grants, DELETE .../grants/{user_id}read / writeWho can see a restricted trail ({"email": ...}; the person must be a member)
POST /trails/{id}/surfacing-testwrite{"draft_text": ..., "document"?: ...}
POST /trails/{id}/run-exampleswriteRun every trigger example and store the summary
POST /content-assetswriteMultipart 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.

StatusSlug
400bad-requestA parameter or the body is malformed
401unauthorizedThe key is missing, wrong, revoked or expired
402upgrade-requiredThe plan does not include API access
403insufficient-scopeThe key lacks the scope named in required_scope
403membership-revoked, forbiddenSee API keys
404not-foundNo such trail in this team
409conflict, idempotency-in-flightThe trail's state does not allow the action, or a retry arrived while the first request is still running
412revision-conflictThe If-Match value is out of date; current_revision gives the current one
413payload-too-largeThe uploaded image is larger than the limit
415unsupported-media-typeThe uploaded file is not a PNG, JPEG, WebP or GIF image
422validation, unprocessable, idempotency-key-mismatchissues lists the fields to fix; or a rule refused the action; or the idempotency key was already used for a different request
423team-pending-deletionThe team is scheduled for deletion
428precondition-requiredPUT .../document was sent without If-Match
429Too many requests; see Rate limits below
503service-unavailableThe 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.

NextWriting a good trail

The rules that make a trail read well and surface at the right moment.

On this page