> For the complete documentation index, see [llms.txt](https://docs.lumidb.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lumidb.com/api-reference/auth.md).

# Auth

Token issuance

## GET /apikeys

> List the calling user's API keys in the current organization, including expired and revoked keys

```json
{"openapi":"3.1.0","info":{"title":"LumiDB HTTP API","version":"0.0.1"},"tags":[{"name":"auth","description":"Token issuance"}],"security":[{"Clerk":[]}],"components":{"securitySchemes":{"Clerk":{"type":"apiKey","in":"header","name":"Authorization","description":"Clerk-issued session JWT (used by the web UI). The full header value is `Clerk <jwt>`."}},"schemas":{"ApiKeyInfo":{"type":"object","required":["key_id","created_at"],"properties":{"created_at":{"type":"string","format":"date-time"},"expires_at":{"type":["string","null"],"format":"date-time"},"first_used_at":{"type":["string","null"],"format":"date-time"},"key_id":{"type":"string","format":"uuid"},"label":{"type":["string","null"]},"last_used_at":{"type":["string","null"],"format":"date-time"},"revoked_at":{"type":["string","null"],"format":"date-time"}}}}},"paths":{"/apikeys":{"get":{"tags":["auth"],"description":"List the calling user's API keys in the current organization, including expired and revoked keys","operationId":"handle_apikey_list","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ApiKeyInfo"}}}}},"403":{"description":""}}}}}}
```

## POST /apikeys

> Create a long-lived API key for the calling user

```json
{"openapi":"3.1.0","info":{"title":"LumiDB HTTP API","version":"0.0.1"},"tags":[{"name":"auth","description":"Token issuance"}],"security":[{"Clerk":[]}],"components":{"securitySchemes":{"Clerk":{"type":"apiKey","in":"header","name":"Authorization","description":"Clerk-issued session JWT (used by the web UI). The full header value is `Clerk <jwt>`."}},"schemas":{"CreateApiKeyParams":{"type":"object","properties":{"expires_in_days":{"type":["integer","null"],"format":"int64","description":"Optional lifetime in days (1-1000). Omit for a non-expiring key.","maximum":1000,"minimum":1},"label":{"type":["string","null"],"description":"Human-readable label shown alongside the key (e.g. \"laptop\", \"CI\")."}}},"CreateApiKeyResponse":{"type":"object","required":["apikey","key_id"],"properties":{"apikey":{"type":"string","description":"The plaintext API key. Returned only once, on creation - store it now."},"expires_at":{"type":["string","null"]},"key_id":{"type":"string","format":"uuid"},"label":{"type":["string","null"]}}}}},"paths":{"/apikeys":{"post":{"tags":["auth"],"description":"Create a long-lived API key for the calling user","operationId":"handle_apikey_create","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiKeyParams"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiKeyResponse"}}}},"400":{"description":""}}}}}}
```

## DELETE /apikeys/{key\_id}

> Revoke one of the calling user's API keys in the current organization

```json
{"openapi":"3.1.0","info":{"title":"LumiDB HTTP API","version":"0.0.1"},"tags":[{"name":"auth","description":"Token issuance"}],"security":[{"Clerk":[]}],"components":{"securitySchemes":{"Clerk":{"type":"apiKey","in":"header","name":"Authorization","description":"Clerk-issued session JWT (used by the web UI). The full header value is `Clerk <jwt>`."}}},"paths":{"/apikeys/{key_id}":{"delete":{"tags":["auth"],"description":"Revoke one of the calling user's API keys in the current organization","operationId":"handle_apikey_revoke","parameters":[{"name":"key_id","in":"path","description":"API key ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":""},"403":{"description":""},"404":{"description":""}}}}}}
```

## POST /create\_token

> Create a new LumiDB token with access to specified tables

```json
{"openapi":"3.1.0","info":{"title":"LumiDB HTTP API","version":"0.0.1"},"tags":[{"name":"auth","description":"Token issuance"}],"security":[{"ApiKey":[]},{"Bearer":[]},{"Basic":[]},{"Clerk":[]},{"Link":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","in":"header","name":"Authorization","description":"Long-lived API key configured in the server's auth file. The full header value is `ApiKey <key>` (note the literal `ApiKey ` prefix, which is not standard HTTP — generated SDKs will need to prepend it)."},"Bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Scoped LumiDB JWT issued by `POST /create_token`. Send as `Authorization: Bearer <jwt>`."},"Basic":{"type":"http","scheme":"basic","description":"HTTP Basic where the password is an API key (username is ignored). Send as `Authorization: Basic base64(\"user:<api_key>\")`."},"Clerk":{"type":"apiKey","in":"header","name":"Authorization","description":"Clerk-issued session JWT (used by the web UI). The full header value is `Clerk <jwt>`."},"Link":{"type":"apiKey","in":"header","name":"Authorization","description":"Short-lived link token granting access to a shared project. The full header value is `Link <token>`."}},"schemas":{"CreateTokenParams":{"type":"object","required":["tables"],"properties":{"tables":{"type":"array","items":{"type":"string"}}}},"TokenResponse":{"type":"object","required":["lumidb_token"],"properties":{"lumidb_token":{"type":"string"}}}}},"paths":{"/create_token":{"post":{"tags":["auth"],"description":"Create a new LumiDB token with access to specified tables","operationId":"handle_token_create","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTokenParams"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}}}}}}}
```

## POST /organizations

> Create a Clerk organization and make the current Clerk user its administrator

```json
{"openapi":"3.1.0","info":{"title":"LumiDB HTTP API","version":"0.0.1"},"tags":[{"name":"auth","description":"Token issuance"}],"security":[{"Clerk":[]}],"components":{"securitySchemes":{"Clerk":{"type":"apiKey","in":"header","name":"Authorization","description":"Clerk-issued session JWT (used by the web UI). The full header value is `Clerk <jwt>`."}},"schemas":{"CreateOrganizationParams":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}},"CreateOrganizationResponse":{"type":"object","required":["slug"],"properties":{"slug":{"type":"string"}}}}},"paths":{"/organizations":{"post":{"tags":["auth"],"description":"Create a Clerk organization and make the current Clerk user its administrator","operationId":"handle_organization_create","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrganizationParams"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrganizationResponse"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lumidb.com/api-reference/auth.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
