Documents API

Store editor content in the cloud

The documents endpoints are the data plane for saved content. Authenticate every request with an API key as a bearer token; each key is an isolated tenant, so you only ever see your own documents.

Endpoints

MethodPathDescription
GET/v1/documentsList your documents (summaries), newest first
POST/v1/documentsCreate a document
GET/v1/documents/:idFetch one document with its content
PUT/v1/documents/:idUpdate title and/or content
DELETE/v1/documents/:idDelete a document

Authentication

Authorization: Bearer <api_key>
Content-Type: application/json

A request without a valid key returns 401 with { "error": "not authenticated" }.

Create a document

Both fields are optional — an empty title is stored as Untitled. Creating past your plan's document limit returns 402 with an upgrade message.

curl -X POST https://cloud.richtexteditor.com/v1/documents \
  -H "Authorization: Bearer $RTE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "title": "Release notes", "content": "<p>v2.4 ships today</p>" }'

# 200 OK
{
  "id": "e2b1…-uuid",
  "title": "Release notes",
  "content": "<p>v2.4 ships today</p>",
  "createdAt": "2026-07-17T09:00:00Z",
  "updatedAt": "2026-07-17T09:00:00Z"
}

List documents

The list returns lightweight summaries — id, title, and timestamps, ordered by most recently updated. Fetch a single document by id to get its content.

curl https://cloud.richtexteditor.com/v1/documents \
  -H "Authorization: Bearer $RTE_KEY"

# 200 OK  — note: no "content" field on summaries
[
  { "id": "e2b1…", "title": "Release notes",
    "createdAt": "2026-07-17T09:00:00Z", "updatedAt": "2026-07-17T09:05:00Z" }
]

Update a document

Send only the fields you want to change — omit title or content to leave it as-is. Every update stamps updatedAt. An unknown id returns 404.

curl -X PUT https://cloud.richtexteditor.com/v1/documents/e2b1… \
  -H "Authorization: Bearer $RTE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "content": "<p>v2.4 shipped</p>" }'

Delete a document

curl -X DELETE https://cloud.richtexteditor.com/v1/documents/e2b1… \
  -H "Authorization: Bearer $RTE_KEY"

# 200 OK
{ "ok": true }

Status codes

CodeWhen
200Success
401Missing or invalid API key
402Create would exceed your plan's document limit
404Document id not found under your account

See the full API reference or create a free account →