# OAuth Jeton OAuth 2.0 « client credentials » (RFC 6749 § 4.4) et révocation (RFC 7009). Adresse de base : `https://kelki.ai/api/v1`. - POST /oauth/token — Obtenir un jeton d'accès (client credentials) - POST /oauth/revoke — Révoquer un jeton d'accès (RFC 7009) ## POST `/oauth/token` Obtenir un jeton d'accès (client credentials) Échange `client_id` + `client_secret` (HTTP Basic, RFC 6749 § 2.3.1) contre un jeton opaque de 15 minutes. Les portées demandées doivent être accordées au client. Le mode (test / live) est celui du client. Authentification : identifiants du client OAuth (HTTP Basic). ### Corps de la requête `application/x-www-form-urlencoded` — TokenRequest (obligatoire) ``` { "grant_type": "client_credentials", "scope": "catalog.read requests.write requests.read" } ``` ### Réponses | Code | Description | Contenu | | `200` | Jeton délivré. | `application/json` TokenResponse | | `400` | Requête invalide (RFC 6749 § 5.2). | `application/json` OAuthError | | `401` | Client inconnu, secret invalide ou révoqué. | `application/json` OAuthError | | `429` | Débit ou quota dépassé. | `application/problem+json` Problem | ### Exemple de réponse ``` { "access_token": "kat_test_EXEMPLE0000000000000000000000000000000", "token_type": "Bearer", "expires_in": 900, "scope": "catalog.read requests.write requests.read" } ``` ## POST `/oauth/revoke` Révoquer un jeton d'accès (RFC 7009) Authentification : identifiants du client OAuth (HTTP Basic). ### Corps de la requête `application/x-www-form-urlencoded` — RevokeRequest (obligatoire) ### Réponses | Code | Description | Contenu | | `200` | Jeton révoqué (réponse identique si le jeton était déjà invalide, RFC 7009 § 2.2). | | | `401` | Client inconnu ou secret invalide. | `application/json` OAuthError | ## Schémas ### `TokenRequest` | Champ | Type | Requis | Description | | `grant_type` | string | oui | valeur : `client_credentials` | | `scope` | string | non | Portées séparées par des espaces. Par défaut, toutes les portées accordées au client. | ### `TokenResponse` | Champ | Type | Requis | Description | | `access_token` | string | oui | | | `token_type` | string | oui | valeur : `Bearer` | | `expires_in` | integer | oui | Durée de validité en secondes. | | `scope` | string | oui | | ### `OAuthError` | Champ | Type | Requis | Description | | `error` | string | oui | valeurs : `invalid_request`, `invalid_client`, `invalid_grant`, `unauthorized_client`, `unsupported_grant_type`, `invalid_scope` | | `error_description` | string | non | | ### `Problem` Détails d'un problème (RFC 9457), avec des membres d'extension. | Champ | Type | Requis | Description | | `type` | string (uri) | oui | URI stable du type de problème ; elle mène à sa documentation. | | `title` | string | oui | | | `status` | integer | oui | min. 400 · max. 599 | | `detail` | string | non | | | `instance` | string (uri-reference) | non | | | `code` | string | oui | Code stable, lisible par une machine. valeurs : `invalid_json`, `invalid_parameter`, `payload_too_large`, `unsupported_media_type`, `invalid_credentials`, `expired_token`, `insufficient_scope`, `live_not_enabled`, `account_suspended`, `country_not_available`, `trade_not_available`, `not_found`, `invalid_state`, `idempotency_in_progress`, `idempotency_key_reused`, `validation_failed`, `consent_missing`, `consent_version_outdated`, `contact_limit_reached`, `duplicate_request`, `rate_limited`, `quota_exceeded`, `agent_paused`, `live_creation_paused`, `service_unavailable`, `internal_error` | | `request_id` | string | oui | | | `errors` | tableau de FieldError | non | | ### `RevokeRequest` | Champ | Type | Requis | Description | | `token` | string | oui | | | `token_type_hint` | string | non | valeurs : `access_token` | ### `FieldError` | Champ | Type | Requis | Description | | `pointer` | string | oui | JSON Pointer (RFC 6901) du champ en cause. | | `detail` | string | oui | | | `allowed` | tableau de string | non | Valeurs acceptées, quand la liste est fermée. | ## Sur cette page - URL : https://kelki.ai/developers/fr/reference/oauth/ - Langue : fr - fr : https://kelki.ai/developers/fr/reference/oauth/ - en : https://kelki.ai/developers/en/reference/oauth/ - x-default : https://kelki.ai/developers/ - Portail : https://kelki.ai/developers/llms.txt