{"templateId":"markdown","versions":[{"version":"v2026.04","label":"v2026.04","link":"/pt-br/products/payments-direct-2/v2026.04/api-docs/tutorials/request-an-access-token","default":true,"active":false,"folderId":"7e5507fe"},{"version":"v2026.03","label":"v2026.03","link":"/pt-br/products/payments-direct-2/v2026.03/api-docs/tutorials/request-an-access-token","default":false,"active":false,"folderId":"7e5507fe"},{"version":"v2025.11","label":"v2025.11","link":"/pt-br/products/payments-direct-2/v2025.11/api-docs/tutorials/request-an-access-token","default":false,"active":true,"folderId":"7e5507fe"}],"sharedDataIds":{"sidebar":"sidebar-@l10n/pt-BR/products/payments-direct-2/@v2025.11/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Request an access token","description":"User guides, API reference, and support resources.","siteUrl":"https://docs.ripple.com","lang":"en-US"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"request-an-access-token","__idx":0},"children":["Request an access token"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Access tokens are used in token-based authentication to grant applications access to APIs on behalf of a user. After a user successfully logs in and authorizes access, the application receives an access token. This token acts as a credential that the application uses to identify itself and the authorized user when calling the target API."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You must include a valid access token in your request header when you send requests to secured API endpoints."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To get an access token, you must have your client ID and client secret. Learn how to generate a client ID and client secret in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/pt-br/products/payments-direct-2/v2025.11/api-docs/payments-direct-api/payments-direct-2-api"},"children":["Payments Direct"," API reference"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"request-format","__idx":1},"children":["Request format"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To get an authentication token for the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["UAT"]}," environment, send a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST"]}," request to the following URL:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"plaintext","header":{"controls":{"copy":{}}},"source":"https://api.test.ripple.com/v2/oauth/token\n","lang":"plaintext"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"authentication-request","__idx":2},"children":["Authentication request"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To get an access token, use the authenticate operation in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/pt-br/products/payments-direct-2/v2025.11/api-docs/payments-direct-api/payments-direct-2-api"},"children":["Payments Direct"," API reference"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Include the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["audience"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["grant_type"]}," as shown in the example below."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The value of the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["audience"]}," field is based on ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://en.wikipedia.org/wiki/Uniform_Resource_Name"},"children":["URN"]}," syntax."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Format"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urn:ripplexcurrent-ENVIRONMENT_STRING:YOUR_TENANT_ID"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["urn:ripplexcurrent-uat:YOUR_TENANT_ID"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST 'https://api.test.ripple.com/v2/oauth/token' \\\n  --header 'Content-Type: application/json' \\\n  --data '{\n    \"client_id\": \"{YOUR_CLIENT_ID}\",\n    \"client_secret\": \"{YOUR_CLIENT_SECRET}\",\n    \"audience\": \"urn:ripplexcurrent-uat:{YOUR_TENANT_ID}\",\n    \"grant_type\": \"client_credentials\"\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"authentication-response","__idx":3},"children":["Authentication response"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Store the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["access_token"]}," for use with all other API operations."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"access_token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJ\",\n  \"scope\": \"identities:create identities:read identities:write quote_collections:write payments:accept payments:read\",\n  \"expires_in\": 3600,\n  \"token_type\": \"Bearer\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"errors","__idx":4},"children":["Errors"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If a token request is rejected, the response body contains an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error"]}," and an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error_description"]},". A ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["403"]}," with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error: unauthorized_client"]}," means the client is not authorized to request a token; a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["403"]}," with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error: access_denied"]}," means the service is not enabled for the requested domain. Handle these based on the HTTP status code rather than the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error"]}," string, and do not retry a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["403"]}," with the same request. For the full list of authentication responses, see the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/pt-br/products/payments-direct-2/v2025.11/api-docs/payments-direct-api/payments-direct-2-api"},"children":["Payments Direct"," API reference"]},"."]}]},"headings":[{"value":"Request an access token","id":"request-an-access-token","depth":1},{"value":"Request format","id":"request-format","depth":3},{"value":"Authentication request","id":"authentication-request","depth":2},{"value":"Authentication response","id":"authentication-response","depth":2},{"value":"Errors","id":"errors","depth":2}],"frontmatter":{"toc":{"enable":true,"maxDepth":2},"seo":{"title":"Request an access token"}},"lastModified":"2026-08-14T15:57:31.000Z","isTranslationFallback":true,"pagePropGetterError":{"message":"","name":""}},"slug":"/pt-br/products/payments-direct-2/v2025.11/api-docs/tutorials/request-an-access-token","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}