Auth API (OIDC)
The public integrator surface of auth.codai.ro: discovery, authorization code + PKCE, device flow, tokens, logout and /connect/key.
auth.codai.ro is a standard OpenID Provider; read /.well-known/openid-configuration first and let your OIDC library drive the rest. The one codai-specific endpoint is GET /connect/key: exchange the access token for a scoped inference key (base_url: https://ai.codai.ro/v1). Only the endpoints an integrator calls are listed — the login/consent UI, account API and native app routes are first-party internals. OIDC errors are { "error", "error_description" }. Flow walkthrough: connect flow, scopes: scopes.
Response Body
application/json
curl -X GET "https://example.com/.well-known/openid-configuration"{ "issuer": "https://auth.codai.ro", "authorization_endpoint": "http://example.com", "token_endpoint": "http://example.com", "userinfo_endpoint": "http://example.com", "jwks_uri": "http://example.com", "introspection_endpoint": "http://example.com", "revocation_endpoint": "http://example.com", "device_authorization_endpoint": "http://example.com", "end_session_endpoint": "http://example.com", "registration_endpoint": "http://example.com", "response_types_supported": [ "string" ], "grant_types_supported": [ "string" ], "token_endpoint_auth_methods_supported": [ "string" ], "scopes_supported": [ "string" ], "claims_supported": [ "string" ], "code_challenge_methods_supported": [ "S256" ], "acr_values_supported": [ "string" ], "subject_types_supported": [ "string" ], "id_token_signing_alg_values_supported": [ "string" ], "backchannel_logout_supported": true}Response Body
application/json
curl -X GET "https://example.com/jwks"{ "keys": [ { "kty": "RSA", "kid": "string", "use": "sig", "alg": "RS256", "n": "string", "e": "string" } ]}Query Parameters
Must be code.
Value in
- "code"
Registered client identifier.
One of the client's registered redirect URIs (exact match).
uriSpace-separated scopes; must include openid.
Opaque CSRF value echoed back on the redirect. Strongly recommended.
BASE64URL(SHA-256(code_verifier)) — PKCE is required for every client.
Only S256 is supported.
Value in
- "S256"
Replay protection echoed into the ID token.
Standard OIDC prompt values (login, consent, none, select_account).
Requested authentication context; passkey/mfa trigger step-up.
RFC 8707 resource indicator. https://ai.codai.ro/mcp yields a JWT access token with the mcp scope.
uricodai extension — signup opens the sign-up form directly.
Value in
- "signup"
codai extension — referral code (codai.ro/r/<username>, 3–20 chars [A-Za-z0-9_]) pre-filled on sign-up.
^[A-Za-z0-9_]{3,20}$UI language of the login pages. Defaults from the NEXT_LOCALE cookie, then Accept-Language.
Value in
- "ro"
- "en"
Response Body
text/html
curl -X GET "https://example.com/auth?response_type=code&client_id=metu&redirect_uri=http%3A%2F%2Fexample.com&scope=openid+email+profile+inference+keys%3Amanage&code_challenge=string&code_challenge_method=S256"Request Body
application/x-www-form-urlencoded
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X POST "https://example.com/device/auth" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d 'client_id=codai-cli'{ "device_code": "string", "user_code": "BCDF-GHJK", "verification_uri": "https://auth.codai.ro/device", "verification_uri_complete": "http://example.com", "expires_in": 0, "interval": 5}Authorization
clientSecretBasic client_secret_basic client authentication. client_secret_post and private_key_jwt go in the form body instead; public clients send only client_id.
In: header
Request Body
application/x-www-form-urlencoded
TypeScript Definitions
Use the request body type in TypeScript.
Form-encoded body. Fields depend on grant_type; client credentials depend on the client's authentication method.
Response Body
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/token" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d 'grant_type=authorization_code'{ "access_token": "string", "token_type": "Bearer", "expires_in": 3600, "scope": "string", "id_token": "string", "refresh_token": "string"}Authorization
clientSecretBasic client_secret_basic client authentication. client_secret_post and private_key_jwt go in the form body instead; public clients send only client_id.
In: header
Request Body
application/x-www-form-urlencoded
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X POST "https://example.com/token/introspection" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d 'token=string'{ "active": true, "scope": "string", "client_id": "string", "sub": "string", "token_type": "string", "exp": 0, "iat": 0, "iss": "http://example.com", "aud": "string", "jti": "string"}Authorization
clientSecretBasic client_secret_basic client authentication. client_secret_post and private_key_jwt go in the form body instead; public clients send only client_id.
In: header
Request Body
application/x-www-form-urlencoded
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/token/revocation" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d 'token=string'Authorization
bearerAuth OAuth access token issued by /token (used by /me and /connect/key).
In: header
Response Body
application/json
application/json
curl -X GET "https://example.com/me"{ "sub": "string", "email": "[email protected]", "email_verified": true, "name": "string", "picture": "http://example.com"}Query Parameters
The ID token previously issued to this client; identifies the session and client.
Registered post-logout redirect URI of the client.
uriOpaque value appended to the post-logout redirect.
Required when id_token_hint is absent and a post_logout_redirect_uri is given.
Standard OIDC parameter; the codai UI reads ?lang=ro|en instead.
Response Body
text/html
text/html
curl -X GET "https://example.com/session/end""string"Authorization
bearerAuth OAuth access token issued by /token (used by /me and /connect/key).
In: header
Header Parameters
First-party clients only — label (≤ 60 chars) for the per-device key; defaults to Desktop.
length <= 60Response Body
application/json
application/json
application/json
application/json
curl -X GET "https://example.com/connect/key"{ "api_key": "codai_xxxxxxxxxxxxxxxxxxxxxxxx", "api_key_id": "b0dd218e-3bcf-4bdb-a1e3-0689d60a8afd", "base_url": "https://ai.codai.ro/v1", "model": "codai", "already_issued": true}curl -X OPTIONS "https://example.com/connect/key"Response Body
application/json
curl -X GET "https://example.com/health"{ "ok": true}Response Body
application/json
application/json
curl -X GET "https://example.com/health/ready"{ "ok": true, "checks": { "db": { "ok": true, "error": "string" } }}