Public API
Use Ogma's key-authenticated HTTP API to build integrations and support apps: legacy ticket panels, CRMs, workflow bots and custom dashboards.
API access is subject to the Developer Terms of Service, including the API access section and Discord's developer terms and policies.
Create an API key
- Open your server in the Ogma dashboard.
- Go to Settings → API keys. You need write access to Settings.
- Select Create key, enter a descriptive name, pick exactly the scopes the integration needs, and optionally set an expiry date.
- Copy the key immediately and store it in your integration's secret manager. Ogma does not show the secret again.
A server can have up to 10 active keys. Rotate issues a new secret and stops the old one working immediately. Revoke disables a key, and a revoked key can then be deleted. Expired and revoked keys get 401.
Each key carries its own set of scopes. There are no fixed roles, and you can change a key's scopes at any time without rotating it:
| Scope | Grants |
|---|---|
tickets:open | Open tickets |
tickets:read | List and read tickets, queue, tags, messages, transcripts |
tickets:write | Reply, reopen, escalate, claim/unclaim, tag |
tickets:close | Close tickets |
guild:read | Guild info, staff list, usage, macros |
webhooks:manage | Manage webhook subscriptions |
knowledge:read | Knowledge Q&A, list and read knowledge sources |
knowledge:write | Create, replace and delete knowledge sources |
analytics:read | Insights, per-staff metrics and CSAT |
Authentication
Send the key as a bearer token. No other header is accepted.
Authorization: Bearer ogma_<keyId>_<secret>GET /api/v1/me needs no scope and returns the key's keyId, name, guildId and scopes. Use it to check a key works:
curl https://api.ogma.gg/api/v1/me \
--header "Authorization: Bearer $OGMA_API_KEY"Tickets
| Method | Path | Scope |
|---|---|---|
GET | /api/v1/tickets | tickets:read |
GET | /api/v1/tickets/queue | tickets:read |
GET | /api/v1/tickets/tags | tickets:read |
GET | /api/v1/tickets/:ticketId | tickets:read |
GET | /api/v1/tickets/:ticketId/messages | tickets:read |
GET | /api/v1/tickets/:ticketId/transcript | tickets:read |
POST | /api/v1/tickets | tickets:open |
POST | /api/v1/tickets/:ticketId/messages | tickets:write |
POST | /api/v1/tickets/:ticketId/close | tickets:close |
POST | /api/v1/tickets/:ticketId/reopen | tickets:write |
POST | /api/v1/tickets/:ticketId/escalate | tickets:write |
POST | /api/v1/tickets/:ticketId/claim | tickets:write |
POST | /api/v1/tickets/:ticketId/unclaim | tickets:write |
PATCH | /api/v1/tickets/:ticketId/tags | tickets:write |
:ticketId is the ticket's publicId (a UUID) or its numeric id.
List tickets
GET /api/v1/tickets accepts:
status:all(default),open,escalated,closedorarchivedownerDiscordId: only tickets opened by this userpage(default 1) andpageSize(default 25, max 100)
The response has tickets, total, page, pageSize and totalPages.
Open a ticket
curl https://api.ogma.gg/api/v1/tickets \
--request POST \
--header "Authorization: Bearer $OGMA_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"ticketTypeId": "customer_support",
"discordUserId": "189912345678901248",
"subject": "Billing help",
"description": "I cannot update my payment method."
}'| Field | Required | Notes |
|---|---|---|
ticketTypeId | Yes | An enabled, non-private ticket type. GET /api/v1/guild lists them |
discordUserId | Yes | The customer. Must be a member of the server and not a bot |
subject | No | Max 200 characters |
description | No | Max 2,000 characters |
Ticket-type rules still apply (open-ticket limits, blocked or required roles, business hours). A successful request returns 201 with ticket: its publicId, publicRef, ticketNumber, ticketTypeId, channelId and ownerDiscordId.
Queue
curl "https://api.ogma.gg/api/v1/tickets/queue?filter=unclaimed" \
--header "Authorization: Bearer $OGMA_API_KEY"Filters: all, unclaimed, escalated, awaiting_staff, awaiting_customer, mine (requires assigneeDiscordId). The response has tickets, total and totals (counts for each filter).
Staff actions
# Claim (actorDiscordId required; must be staff)
curl https://api.ogma.gg/api/v1/tickets/$TICKET_ID/claim \
--request POST \
--header "Authorization: Bearer $OGMA_API_KEY" \
--header "Content-Type: application/json" \
--data '{ "actorDiscordId": "189912345678901248" }'
# Reply
curl https://api.ogma.gg/api/v1/tickets/$TICKET_ID/messages \
--request POST \
--header "Authorization: Bearer $OGMA_API_KEY" \
--header "Content-Type: application/json" \
--data '{ "content": "Looking into this now.", "actorDiscordId": "189912345678901248" }'
# Close
curl https://api.ogma.gg/api/v1/tickets/$TICKET_ID/close \
--request POST \
--header "Authorization: Bearer $OGMA_API_KEY" \
--header "Content-Type: application/json" \
--data '{ "closeReason": "resolved" }'| Action | Body |
|---|---|
| Claim, unclaim | actorDiscordId (required; must be staff) |
| Reply | content (required, max 4,000 characters), actorDiscordId (optional). With an actor, who must be staff, the message is sent as their staff reply. Without one, the bot posts [API: <key name>]: <content> |
| Close | closeReason (required): resolved, duplicate, user_ghosted, user_left, out_of_scope, spam, inactivity or other. Optional closeReasonNote (max 500) and actorDiscordId (must be staff) |
| Reopen | Optional actorDiscordId |
| Escalate | Optional actorDiscordId and reason (max 500) |
| Tags | tags: an array that replaces the ticket's tags. Tags are lowercased, max 40 characters each and 20 in total. [] clears them |
The transcript endpoint returns the HTML transcript as a file download.
Guild
| Method | Path | Scope |
|---|---|---|
GET | /api/v1/guild | guild:read |
GET | /api/v1/guild/staff | guild:read |
GET | /api/v1/guild/usage | guild:read |
GET | /api/v1/macros | guild:read |
GET /api/v1/guild returns the server's id, name and ticketTypes: the enabled, non-private types you can open through the API, each with id, label, description and maxOpenPerUser. GET /api/v1/guild/staff lists Discord members with staff roles (discordUserId, displayName, username), and is empty if no staff roles are set.
Webhooks
Webhooks need Plus or Enterprise (otherwise 402 plan_required) and the webhooks:manage scope. Plus allows up to 5 webhooks; Enterprise has no limit.
| Method | Path |
|---|---|
GET | /api/v1/webhooks |
POST | /api/v1/webhooks |
PATCH | /api/v1/webhooks/:webhookId |
DELETE | /api/v1/webhooks/:webhookId |
curl https://api.ogma.gg/api/v1/webhooks \
--request POST \
--header "Authorization: Bearer $OGMA_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"name": "CRM",
"url": "https://example.com/ogma-hooks",
"secret": "your-hmac-secret",
"events": ["ticket.opened", "ticket.closed", "ticket.escalated"]
}'Creating a webhook needs name (max 80 characters), an https:// url and a non-empty events array. secret is optional, and enabled defaults to true. PATCH accepts any of those fields. Set secret to null to remove it. Responses never include the secret, only hasSecret.
Events: ticket.opened, ticket.claimed, ticket.unclaimed, ticket.tagged, ticket.escalated, ticket.reopened, ticket.message.created, ticket.closed, csat.received, csat.negative, sla.breach. See Support ops → Webhooks for when each one fires.
Delivery body:
{
"event": "ticket.opened",
"guildId": "…",
"occurredAt": "2026-07-20T12:00:00.000Z",
"payload": {}
}Each delivery carries X-Ogma-Event, X-Ogma-Delivery and X-Ogma-Timestamp headers. When a secret is set, verify X-Ogma-Signature-V2 (t=<timestamp>,v1=<hex>, an HMAC-SHA256 of <timestamp>.<raw body>) and reject timestamps older than about five minutes. The legacy X-Ogma-Signature: sha256=<hex> header is still sent. See Verifying the signature and Retries and delivery history.
Knowledge
curl https://api.ogma.gg/api/v1/knowledge/ask \
--request POST \
--header "Authorization: Bearer $OGMA_API_KEY" \
--header "Content-Type: application/json" \
--data '{ "question": "How do I reset my password?" }'Requires knowledge:read. question can be up to 2,000 characters. Returns { question, answer, shouldAnswer, confidence, reasoning }; answer can be null. Asks use your server's AI token allowance like any other AI reply.
Manage the library itself to keep Ogma's knowledge in step with your own docs:
| Method | Path | Scope |
|---|---|---|
GET | /api/v1/knowledge | knowledge:read |
GET | /api/v1/knowledge/{documentKey} | knowledge:read |
POST | /api/v1/knowledge | knowledge:write |
PATCH | /api/v1/knowledge/{documentKey} | knowledge:write |
DELETE | /api/v1/knowledge/{documentKey} | knowledge:write |
GET /api/v1/knowledgeacceptspageandpageSize(default 25, max 100).POSTtakescontent(required, max 500,000 characters), an optionaltitle(max 200) and an optionalparentFolderId. Ogma generates thedocumentKeyand returns it indocument.PATCHreplaces the source:contentis required, andtitlerenames it.- Creating or replacing a source chunks and embeds the content, so it is searchable as soon as the request returns. It uses your plan's embedding token allowance, and is refused if the allowance can't cover it.
DELETEremoves the source, its chunks, its sync configuration and its pin.
Analytics
| Method | Path | Scope |
|---|---|---|
GET | /api/v1/insights?days=30 | analytics:read |
GET | /api/v1/insights/staff?days=30 | analytics:read |
GET | /api/v1/csat?days=30 | analytics:read |
days can be 7, 30 or 90 and defaults to 30. Free and Basic allow only 7 days; Plus and Enterprise allow all three. Any other value is replaced with the longest window your plan allows, and each response reports the days actually used.
Idempotent writes
Send an Idempotency-Key header on POST and PATCH requests to make retries safe:
curl https://api.ogma.gg/api/v1/tickets \
--request POST \
--header "Authorization: Bearer $OGMA_API_KEY" \
--header "Idempotency-Key: $(uuidgen)" \
--header "Content-Type: application/json" \
--data '{ "ticketTypeId": "support", "discordUserId": "…", "subject": "…" }'Retrying with the same key returns the original response and an Idempotent-Replay: true header instead of opening a second ticket. Keys are scoped to your API key, must be 8–255 characters, and stay replayable for at least 24 hours. Use a new key for every distinct request.
| Situation | Response |
|---|---|
| Same key, same body, original finished | The original response, with Idempotent-Replay: true |
| Same key, same body, original still running (up to 60 seconds) | 409 idempotency_in_flight |
| Same key, different body | 422 idempotency_key_reuse |
Original returned 5xx | Key released: your retry runs as a fresh request |
4xx responses are stored and replayed like successes. After fixing a request that failed with 4xx, send it with a new key.
Errors
Error responses have an error message and a code.
| Status | Codes | Meaning |
|---|---|---|
400 | invalid_body, invalid_query, invalid_ticket_id, invalid_close_reason, invalid_idempotency_key | Bad request |
401 | unauthorized | Missing, invalid, revoked or expired key |
402 | plan_required | Feature or limit not on your current plan |
403 | missing_scope, actor_not_staff, blocked_role, missing_role, outside_hours, forbidden | Not allowed |
404 | ticket_not_found, guild_not_found, webhook_not_found, document_not_found, user_not_member, actor_not_member, type_unavailable, transcript_not_found, transcript_deleted, … | Missing resource |
409 | ticket_conflict, ticket_not_open, max_open, categories_full, idempotency_in_flight | State conflict |
422 | idempotency_key_reuse | Idempotency key reused with a different body |
429 | rate_limited | Rate limit or AI allowance exceeded |
500 | create_failed, ask_failed | Unexpected failure |
503 | bot_not_in_guild, missing_bot_permissions, channel_not_found, message_failed, action_failed, close_failed, transcript_unavailable, service_busy, analytics_timeout, … | Discord or Ogma temporarily unavailable. Retry later |
Rate limits
- Each key can make 60 requests per minute.
- Ticket opens are limited to 240 per hour per server, across all keys. Rejected opens still count.
- Knowledge ask also counts against the server's AI rate limits. All keys on a server share one budget of 20 asks per hour.
Responses carry your current per-key budget, so you can pace requests before you hit 429:
| Header | Meaning |
|---|---|
X-RateLimit-Limit | Requests allowed in the window |
X-RateLimit-Remaining | Requests left after this one |
X-RateLimit-Reset | Unix seconds when a slot frees up |
A 429 from the per-key or ticket-open limit also returns Retry-After in seconds.
Building an app
- Create a key with the ticket scopes plus
guild:read,knowledge:readandwebhooks:manage. Addknowledge:writeto sync your own docs in, andanalytics:readto pull reporting. - Register webhooks for ticket lifecycle events.
- Poll
GET /api/v1/tickets/queuefor the inbox, and use webhooks to know when to refresh. - Use claim, messages and close for staff actions, and
GET /api/v1/guild/stafffor assignee pickers. - Optionally expose
POST /api/v1/knowledge/askfor a docs assistant.
