Exchange authorization code for API key

POST

Exchange an authorization code from the PKCE flow for a user-controlled API key

Request

This endpoint expects an object.
codestringRequired

The authorization code received from the OAuth redirect

code_verifierstringOptional

The code verifier if code_challenge was used in the authorization request

code_challenge_methodenumOptional
Allowed values: S256plain

The method used to generate the code challenge

Response

Successfully exchanged code for an API key

keystring

The API key to use for OpenRouter requests

user_idstringOptional

User ID associated with the API key

Errors

Built with