> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.runpayments.io/reference/reporting-boarding/authentication/get-access-token/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.runpayments.io/_mcp/server. # Get access token POST https://apps.runpayments.io/ords/sprint/oauth/token Content-Type: application/x-www-form-urlencoded **Click the above URL to toggle between Reporting and Boarding APIs.** Obtain an OAuth 2.0 access token using basic authentication. Authentication requires a Base64 encoded authorization header with your `client_id` as the username and your `client_secret` as the password. Reference: https://docs.runpayments.io/reference/reporting-boarding/authentication/get-access-token ## Authentication - `Authorization` header (basic auth, required) — Basic authentication using client\_id as username and client\_secret as password. Headers must include: ``` Authorization: Basic ``` where the encoded credentials are `base64(client_id:client_secret)`. ## Servers - `https://apps.runpayments.io/ords/sprint` (Reporting API, default) - `https://apps.runpayments.io/ords/relay` (Boarding API) ## Request ### Body (application/x-www-form-urlencoded) This endpoint expects an object. - `grant_type` (enum, required) — Must be "client_credentials" - Allowed values: `client_credentials` ## Response ### 200 Successful token response - `access_token` (string, required) — The access token to use for authenticated requests - `token_type` (string, required) — The token type - `expires_in` (integer, required) — Token expiration time in seconds ## Errors ### 400 Bad Request Error Bad request - `error` (string, optional) — Error code - `error_description` (string, optional) — Detailed error description ### 401 Unauthorized Error Unauthorized - invalid client credentials - `error` (string, optional) — Error code - `error_description` (string, optional) — Detailed error description ## Examples **Request** ```json { "grant_type": "client_credentials" } ``` **Response** ```json { "access_token": "string", "token_type": "Bearer", "expires_in": 3600 } ``` **SDK Code** ```python import requests url = "https://apps.runpayments.io/ords/sprint/oauth/token" payload = "" headers = { "Content-Type": "application/x-www-form-urlencoded" } response = requests.post(url, data=payload, headers=headers, auth=("", "")) print(response.json()) ``` ```javascript const url = 'https://apps.runpayments.io/ords/sprint/oauth/token'; const credentials = btoa(":"); const options = { method: 'POST', headers: { Authorization: `Basic ${credentials}`, 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams('') }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://apps.runpayments.io/ords/sprint/oauth/token" req, _ := http.NewRequest("POST", url, nil) req.SetBasicAuth("", "") req.Header.Add("Content-Type", "application/x-www-form-urlencoded") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://apps.runpayments.io/ords/sprint/oauth/token") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request.basic_auth("", "") request["Content-Type"] = 'application/x-www-form-urlencoded' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://apps.runpayments.io/ords/sprint/oauth/token") .basicAuth("", "") .header("Content-Type", "application/x-www-form-urlencoded") .asString(); ``` ```php request('POST', 'https://apps.runpayments.io/ords/sprint/oauth/token', [ 'form_params' => null, 'headers' => [ 'Content-Type' => 'application/x-www-form-urlencoded', ], 'auth' => ['', ''], ]); echo $response->getBody(); ``` ```csharp using RestSharp; using RestSharp.Authenticators; var client = new RestClient("https://apps.runpayments.io/ords/sprint/oauth/token"); client.Authenticator = new HttpBasicAuthenticator("", ""); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/x-www-form-urlencoded"); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let credentials = Data(":".utf8).base64EncodedString() let headers = [ "Authorization": "Basic \(credentials)", "Content-Type": "application/x-www-form-urlencoded" ] let request = NSMutableURLRequest(url: NSURL(string: "https://apps.runpayments.io/ords/sprint/oauth/token")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```