DocsREST API

Auth and account

Sign up, log in, log out, and read or update the current user.

On this page

These endpoints create and use session tokens (gt-sess-…), which represent a person. Machines should use project API keys instead.

Sign up

POST /v1/auth/signup

Creates a user and a personal organization (named “’s workspace”) with the user as its owner, and returns a session token with status 201. Emails are lowercased.

curl -X POST https://generic-translation-api.jacobfv123.workers.dev/v1/auth/signup \
  -H "content-type: application/json" \
  -d '{ "email": "ada@example.com", "password": "correct horse battery staple", "name": "Ada" }'
Field Type Required Notes
email string yes A valid address, at most 254 characters. Must be unique.
password string yes 8 to 200 characters. Stored only as a salted PBKDF2 hash.
name string yes Display name, 1 to 120 characters.
{
  "token": "gt-sess-…",
  "user": { "id": "usr_8f3k2…", "email": "ada@example.com", "name": "Ada", "createdAt": "2026-11-30T10:00:00.000Z" },
  "org": { "id": "org_p01xz…", "name": "Ada's workspace", "createdAt": "2026-11-30T10:00:00.000Z", "updatedAt": "2026-11-30T10:00:00.000Z", "role": "owner" }
}

Errors: 400 invalid_request (bad email, password shorter than 8 characters, missing fields), 409 conflict (email already registered), 429 rate_limited (see rate limits).

Log in

POST /v1/auth/login

curl -X POST https://generic-translation-api.jacobfv123.workers.dev/v1/auth/login \
  -H "content-type: application/json" \
  -d '{ "email": "ada@example.com", "password": "correct horse battery staple" }'
{
  "token": "gt-sess-…",
  "user": { "id": "usr_8f3k2…", "email": "ada@example.com", "name": "Ada", "createdAt": "2026-11-30T10:00:00.000Z" }
}

Errors: 401 unauthenticated for a wrong email or password (the response does not say which), 429 rate_limited.

Log out

POST /v1/auth/logout

Revokes the session token sent in the Authorization header. The token stops working immediately. Returns { "ok": true }. Calling it without a session token also returns { "ok": true } and changes nothing.

curl -X POST https://generic-translation-api.jacobfv123.workers.dev/v1/auth/logout \
  -H "authorization: Bearer $GENERIC_TRANSLATION_SESSION"

Get the current user

GET /v1/me

Returns the user and every organization they belong to, with their role in each.

{
  "user": { "id": "usr_8f3k2…", "email": "ada@example.com", "name": "Ada", "createdAt": "2026-11-30T10:00:00.000Z" },
  "orgs": [
    { "id": "org_p01xz…", "name": "Ada's workspace", "role": "owner", "createdAt": "2026-11-30T10:00:00.000Z", "updatedAt": "2026-11-30T10:00:00.000Z" },
    { "id": "org_77bqm…", "name": "Analytical Engines", "role": "member", "createdAt": "2026-10-02T08:30:00.000Z", "updatedAt": "2026-10-02T08:30:00.000Z" }
  ]
}

Errors: 401 unauthenticated; 403 permission_missing if called with a project API key (these routes need a session).

Update the current user

PATCH /v1/me

Field Type Notes
name string New display name.
password string New password, 8 to 200 characters. Changing it signs out every other session of the user; the current one stays valid.

Send only the fields you want to change.

curl -X PATCH https://generic-translation-api.jacobfv123.workers.dev/v1/me \
  -H "authorization: Bearer $GENERIC_TRANSLATION_SESSION" \
  -H "content-type: application/json" \
  -d '{ "name": "Ada Lovelace" }'

Returns { "user": { … } }. Errors: 400 invalid_request, 401 unauthenticated.

Something wrong or unclear on this page? Open an issue.

Type to search the documentation.