{"openapi":"3.1.0","info":{"title":"Relyr API","version":"1.0.0","description":"Transactional email delivery API. Send, track, and manage emails through a simple REST interface.\n\nBase URL: `https://app.getrelyr.io`.\n\nEvery request needs a Bearer token: an API key (`sk_live_…`), or a CLI login token from `relyr login` (the device flow under `/api/auth/device/*`). Each operation names the scope it needs. A CLI login holds every scope; an API key holds the scopes chosen when it was created and can never manage keys.\n\nErrors are `{\"error\": {\"code\", \"message\", \"request_id\"}}`; the request id is also in the `X-Request-ID` header. Lists are `{\"data\": [...]}`."},"servers":[{"url":"https://app.getrelyr.io","description":"Production"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"An API key in the format `sk_live_<64-hex-chars>`, or a CLI login token from `relyr login`."}},"schemas":{"SendEmailInput":{"type":"object","required":["from","to"],"properties":{"from":{"type":"string","description":"Sender address, e.g. `hello@example.com` or `Company <hello@example.com>`","example":"hello@example.com"},"to":{"type":"array","items":{"type":"string","format":"email"},"minItems":1,"maxItems":50,"description":"Recipient email addresses","example":["ada@example.com"]},"cc":{"type":"array","items":{"type":"string","format":"email"},"maxItems":50},"bcc":{"type":"array","items":{"type":"string","format":"email"},"maxItems":50},"subject":{"type":"string","maxLength":998,"description":"Subject line. Required unless `template` is set, which supplies a default. May contain `{{variable}}` placeholders, e.g. `{{code}} is your {{app_name}} code`.","example":"Welcome aboard"},"html":{"type":"string","description":"HTML body. Ignored when `template` is set."},"text":{"type":"string","description":"Plain text body"},"template":{"type":"string","enum":["otp_code","pin_code","magic_link","email_verification","password_reset","password_changed","new_login_alert","account_created","account_deleted","subscription_confirm","subscribed","unsubscribed","thank_you","welcome","password-reset"],"description":"Customer template to render with your brand. `welcome` and `password-reset` are aliases of `account_created` and `password_reset`. See `GET /api/v1/templates`."},"variables":{"type":"object","additionalProperties":{"oneOf":[{"type":"string","maxLength":2000},{"type":"number"}]},"description":"Template variables. Unknown variables are rejected. Every template also accepts brand variables: `app_name`, `logo_url`, `accent_color`, `support_email`, `website_url`, `company_address`."},"reply_to":{"type":"string","format":"email"},"tags":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","pattern":"^[a-zA-Z0-9_-]{1,256}$"},"value":{"type":"string","pattern":"^[a-zA-Z0-9_-]{1,256}$"}}},"maxItems":10},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"Custom headers: `X-*`, plus `List-Unsubscribe` (`<https://…>` and/or `<mailto:…>`) and `List-Unsubscribe-Post: List-Unsubscribe=One-Click` (RFC 8058)."}}},"SendEmailResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string","description":"Quote this when contacting support."}}}}},"TemplateVariable":{"type":"object","required":["name","group","type","description"],"properties":{"name":{"type":"string"},"group":{"type":"string","enum":["template","brand"]},"type":{"type":"string","enum":["text","long_text","url","email","code","integer","color"]},"required":{"type":"boolean"},"default":{"type":"string"},"description":{"type":"string"},"sample":{"type":"string"}}},"Template":{"type":"object","required":["id","name","category","description","subject","variables","sample_variables"],"properties":{"id":{"type":"string","enum":["otp_code","pin_code","magic_link","email_verification","password_reset","password_changed","new_login_alert","account_created","account_deleted","subscription_confirm","subscribed","unsubscribed","thank_you"]},"name":{"type":"string"},"category":{"type":"string"},"description":{"type":"string"},"subject":{"type":"string","description":"Default subject with `{{variable}}` placeholders."},"variables":{"type":"array","items":{"$ref":"#/components/schemas/TemplateVariable"}},"sample_variables":{"type":"object","additionalProperties":{"type":"string"}}}},"TemplatePreviewInput":{"type":"object","additionalProperties":false,"properties":{"subject":{"type":"string","maxLength":998,"description":"Optional subject override with placeholders."},"variables":{"type":"object","additionalProperties":{"oneOf":[{"type":"string","maxLength":2000},{"type":"number"}]},"description":"Template variables. Unknown variables are rejected. Every template also accepts brand variables: `app_name`, `logo_url`, `accent_color`, `support_email`, `website_url`, `company_address`."}}},"TemplatePreview":{"type":"object","required":["template","subject","preview","html","text"],"properties":{"template":{"type":"string"},"subject":{"type":"string"},"preview":{"type":"string","description":"Inbox preview text."},"html":{"type":"string"},"text":{"type":"string"}}},"Scope":{"type":"string","enum":["account:read","domains:read","domains:write","emails:send","emails:read","templates:read","usage:read","keys:read","keys:write"]},"Account":{"type":"object","required":["id","email","auth"],"properties":{"id":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":"string"},"emailVerified":{"type":"boolean"},"twoFactorEnabled":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"auth":{"type":"object","description":"The token making this request. Never includes the token itself.","required":["type","scopes"],"properties":{"type":{"type":"string","enum":["cli","api_key"]},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}},"expiresAt":{"type":"string","format":"date-time","description":"CLI logins only. Extended on use."},"keyId":{"type":"string","description":"API keys only."},"domainId":{"type":["string","null"],"description":"API keys only: the one domain the key may send from."}}}}},"DnsRecord":{"type":"object","required":["type","name","value"],"properties":{"type":{"type":"string","enum":["TXT","CNAME","MX"]},"name":{"type":"string"},"value":{"type":"string"},"check":{"type":"object","description":"What public DNS answered for this sending record on a verify call. Present only while ownership is confirmed and sending is not yet verified.","required":["status"],"properties":{"status":{"type":"string","enum":["found","missing","mismatch","unknown"]},"found":{"type":"array","items":{"type":"string"},"description":"What DNS returns instead, when status is mismatch."}}}}},"Domain":{"type":"object","required":["id","name","status","ownershipStatus","ownershipRecord","records"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["pending","verified","failed"],"description":"Sending status: verified once ownership and sending DNS are confirmed."},"ownershipStatus":{"type":"string","enum":["pending","verified"]},"ownershipRecord":{"$ref":"#/components/schemas/DnsRecord"},"records":{"type":"array","description":"Sending DNS records to publish after ownership is confirmed.","items":{"$ref":"#/components/schemas/DnsRecord"}},"verificationError":{"type":["string","null"],"description":"What is still missing, in words to show the user. While ownershipStatus is pending it is about the ownership TXT record (which never expires); afterwards it is about the sending records."},"lastCheckedAt":{"type":["string","null"],"format":"date-time"},"deletionState":{"type":"string","enum":["active","deleting","deleted"]},"createdAt":{"type":"string","format":"date-time"}}},"ApiKey":{"type":"object","required":["id","name","prefix","scopes","createdAt"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"prefix":{"type":"string","description":"The key's first characters, to recognise it."},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}},"domainId":{"type":["string","null"]},"domainName":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"lastUsedAt":{"type":["string","null"],"format":"date-time"},"revokedAt":{"type":["string","null"],"format":"date-time"},"emailCount":{"type":"integer"}}},"CreateApiKeyInput":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":80},"domainId":{"type":"string","format":"uuid","description":"Limit the key to sending from this domain. Such a key can only hold emails:send, emails:read and templates:read."},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"},"description":"Default: emails:read, emails:send, templates:read. keys:* can't be given to a key."}}},"CreatedApiKey":{"type":"object","required":["id","key","prefix","name","scopes"],"properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string","description":"Shown once. Relyr stores only its hash."},"prefix":{"type":"string"},"name":{"type":"string"},"domainId":{"type":["string","null"]},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}}}},"Usage":{"type":"object","properties":{"plan":{"type":"object","properties":{"code":{"type":["string","null"]},"name":{"type":["string","null"]}}},"status":{"type":"string"},"period":{"type":"object","properties":{"start":{"type":"string","format":"date-time"},"end":{"type":"string","format":"date-time"},"cancelAtPeriodEnd":{"type":"boolean"}}},"emails":{"type":"object","properties":{"today":{"type":"object","required":["used","limit"],"properties":{"used":{"type":"integer"},"limit":{"type":"integer"},"resetsAt":{"type":"string","format":"date-time"}}},"month":{"type":"object","required":["used","limit"],"properties":{"used":{"type":"integer"},"limit":{"type":"integer"},"resetsAt":{"type":"string","format":"date-time"}}}}},"domains":{"type":"object","properties":{"used":{"type":"integer"},"limit":{"type":"integer"}}},"rateLimits":{"type":"object","properties":{"emailsPerSecond":{"type":"integer"},"apiRequestsPerSecond":{"type":"integer"}}}}},"DeviceCode":{"type":"object","properties":{"device_code":{"type":"string","description":"Secret. Keep it in the CLI; only it can collect the token."},"user_code":{"type":"string","description":"8 characters; show as XXXX-XXXX for the user to type."},"verification_uri":{"type":"string","format":"uri"},"verification_uri_complete":{"type":"string","format":"uri","description":"Don't open this one: the user must type the code (see the page's note)."},"expires_in":{"type":"integer"},"interval":{"type":"integer"}}},"DeviceToken":{"type":"object","properties":{"access_token":{"type":"string"},"token_type":{"type":"string","enum":["Bearer"]},"expires_in":{"type":"integer"},"scope":{"type":"string"}}},"OAuthError":{"type":"object","properties":{"error":{"type":"string"},"error_description":{"type":"string"}}}}},"paths":{"/api/v1/emails":{"post":{"summary":"Send an email","description":"Send a transactional email. Requires a valid API key with Bearer auth.\n\nIdempotency is supported via the `Idempotency-Key` header.\n\nScope: `emails:send`.","operationId":"sendEmail","security":[{"apiKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","maxLength":200},"description":"Optional idempotency key (printable ASCII). Must be unique per API key."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendEmailInput"},"example":{"from":"Acme <hello@example.com>","to":["ada@example.com"],"template":"otp_code","variables":{"code":"482913","purpose":"sign in","app_name":"Acme"}}}}},"responses":{"202":{"description":"Email accepted for delivery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendEmailResponse"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The token lacks the scope (`insufficient_scope`), or the workspace is suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation error (e.g., domain not verified, invalid input)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded"}},"x-relyr-scope":"emails:send"}},"/api/v1/emails/{id}":{"get":{"summary":"Get email details","description":"Retrieve an email's delivery status and event history.\n\nScope: `emails:read`.","operationId":"getEmail","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Email details with event history"},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The token lacks the scope (`insufficient_scope`), or the workspace is suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Email not found"},"429":{"description":"Rate limit; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-relyr-scope":"emails:read"}},"/api/v1/templates":{"get":{"summary":"List templates","description":"Customer templates you can send with your own brand, with their variables and sample values.\n\nScope: `templates:read`.","operationId":"listTemplates","security":[{"apiKey":[]}],"responses":{"200":{"description":"Templates","content":{"application/json":{"schema":{"type":"object","properties":{"templates":{"type":"array","items":{"$ref":"#/components/schemas/Template"}}}}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The token lacks the scope (`insufficient_scope`), or the workspace is suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-relyr-scope":"templates:read"}},"/api/v1/templates/{id}":{"get":{"summary":"Get a template","operationId":"getTemplate","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"example":"otp_code"}],"responses":{"200":{"description":"Template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The token lacks the scope (`insufficient_scope`), or the workspace is suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Unknown template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-relyr-scope":"templates:read","description":"Scope: `templates:read`."}},"/api/v1/templates/{id}/preview":{"post":{"summary":"Preview a template","description":"Renders subject, HTML and plain text exactly as a send would, without sending. Validation matches `POST /api/v1/emails`. `app_name` defaults to \"Your app\" here and to the sender domain when sending.\n\nScope: `templates:read`.","operationId":"previewTemplate","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"example":"otp_code"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplatePreviewInput"},"example":{"variables":{"code":"482913","app_name":"Acme"},"subject":"{{code}} is your {{app_name}} code"}}}},"responses":{"200":{"description":"Rendered template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplatePreview"}}}},"401":{"description":"Invalid or missing API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The token lacks the scope (`insufficient_scope`), or the workspace is suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Unknown template, invalid variables or placeholders","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-relyr-scope":"templates:read"}},"/api/v1/account":{"get":{"summary":"Get the account and token","description":"The account behind the token, and what the token may do.\n\nScope: `account:read`.","operationId":"getAccount","security":[{"apiKey":[]}],"x-relyr-scope":"account:read","responses":{"200":{"description":"Account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The token lacks the scope (`insufficient_scope`), or the workspace is suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/auth/logout":{"post":{"summary":"Sign out a CLI login","description":"Ends the CLI login on the server. API keys are revoked instead (`DELETE /api/v1/keys/{id}`).\n\nScope: `account:read`.","operationId":"logout","security":[{"apiKey":[]}],"x-relyr-scope":"account:read","responses":{"200":{"description":"Signed out","content":{"application/json":{"schema":{"type":"object","properties":{"signedOut":{"type":"boolean"}}}}}},"400":{"description":"Called with an API key (`not_a_login`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The token lacks the scope (`insufficient_scope`), or the workspace is suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/domains":{"get":{"summary":"List domains","description":"Stored state; use verify to check DNS again.\n\nScope: `domains:read`.","operationId":"listDomains","security":[{"apiKey":[]}],"x-relyr-scope":"domains:read","responses":{"200":{"description":"Domains","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Domain"}}}}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The token lacks the scope (`insufficient_scope`), or the workspace is suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Add a domain","description":"Returns the TXT record that proves ownership.\n\nScope: `domains:write`.","operationId":"addDomain","security":[{"apiKey":[]}],"x-relyr-scope":"domains:write","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Domain"}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The token lacks the scope (`insufficient_scope`), or the workspace is suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Already in this workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Invalid or reserved domain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","example":"example.com"}}}}}}}},"/api/v1/domains/{domain}":{"get":{"summary":"Get a domain","description":"Scope: `domains:read`.","operationId":"getDomain","security":[{"apiKey":[]}],"x-relyr-scope":"domains:read","responses":{"200":{"description":"Domain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Domain"}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The token lacks the scope (`insufficient_scope`), or the workspace is suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"domain","in":"path","required":true,"description":"The domain's id or its name.","schema":{"type":"string"}}]},"delete":{"summary":"Delete a domain","description":"Stops sending from the domain; provider cleanup follows after a short grace period.\n\nScope: `domains:write`.","operationId":"deleteDomain","security":[{"apiKey":[]}],"x-relyr-scope":"domains:write","responses":{"200":{"description":"Deletion started","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean"}}}}}},"400":{"description":"Already being deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The token lacks the scope (`insufficient_scope`), or the workspace is suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"domain","in":"path","required":true,"description":"The domain's id or its name.","schema":{"type":"string"}}]}},"/api/v1/domains/{domain}/verify":{"post":{"summary":"Check a domain's DNS now","description":"Checks ownership, then sending DNS. Poll it to wait for verification.\n\nScope: `domains:write`.","operationId":"verifyDomain","security":[{"apiKey":[]}],"x-relyr-scope":"domains:write","responses":{"200":{"description":"Domain after the check","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Domain"}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The token lacks the scope (`insufficient_scope`), or the workspace is suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"domain","in":"path","required":true,"description":"The domain's id or its name.","schema":{"type":"string"}}]}},"/api/v1/keys":{"get":{"summary":"List API keys","description":"Never includes keys themselves. Needs a CLI login.\n\nScope: `keys:read`.","operationId":"listKeys","security":[{"apiKey":[]}],"x-relyr-scope":"keys:read","responses":{"200":{"description":"Keys","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}}}}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The token lacks the scope (`insufficient_scope`), or the workspace is suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create an API key","description":"The key is in this response only. Needs a CLI login.\n\nScope: `keys:write`.","operationId":"createKey","security":[{"apiKey":[]}],"x-relyr-scope":"keys:write","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatedApiKey"}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The token lacks the scope (`insufficient_scope`), or the workspace is suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Invalid name, domain or scopes (`invalid_scope`)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiKeyInput"}}}}}},"/api/v1/keys/{id}":{"delete":{"summary":"Revoke an API key","description":"Scope: `keys:write`.","operationId":"revokeKey","security":[{"apiKey":[]}],"x-relyr-scope":"keys:write","responses":{"200":{"description":"Revoked","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}}}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The token lacks the scope (`insufficient_scope`), or the workspace is suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}]}},"/api/v1/usage":{"get":{"summary":"Get usage and limits","description":"Scope: `usage:read`.","operationId":"getUsage","security":[{"apiKey":[]}],"x-relyr-scope":"usage:read","responses":{"200":{"description":"Usage","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Usage"}}}},"401":{"description":"Missing, invalid or expired token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The token lacks the scope (`insufficient_scope`), or the workspace is suspended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/auth/device/code":{"post":{"summary":"Start a CLI login","operationId":"deviceCode","tags":["CLI login"],"description":"RFC 8628 device authorization. Show `user_code` and ask the user to open `verification_uri` and type it. Limited to 5 requests a minute per IP.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["client_id"],"properties":{"client_id":{"type":"string","enum":["relyr-cli"]}}}}}},"responses":{"200":{"description":"Codes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceCode"}}}},"400":{"description":"`invalid_client` and other OAuth errors","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}}}}},"/api/auth/device/token":{"post":{"summary":"Collect the CLI login token","operationId":"deviceToken","tags":["CLI login"],"description":"Poll every `interval` seconds. Until approved: `authorization_pending`; too fast: `slow_down` (add 5 seconds); then `access_denied`, `expired_token`, or the token, once.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["grant_type","device_code","client_id"],"properties":{"grant_type":{"type":"string","enum":["urn:ietf:params:oauth:grant-type:device_code"]},"device_code":{"type":"string"},"client_id":{"type":"string","enum":["relyr-cli"]}}}}}},"responses":{"200":{"description":"The token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceToken"}}}},"400":{"description":"authorization_pending, slow_down, access_denied, expired_token, invalid_grant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}}}}}}}