Get an access token (OAuth 2.0 client credentials)
using System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Post, RequestUri = new Uri("https://app.quatlasglobal.com/api/integrations/v1/oauth/token"), Headers = { { "Authorization", "Basic <credentials>" }, }, Content = new FormUrlEncodedContent(new Dictionary<string, string> { { "client_id", "example" }, { "client_secret", "example" }, { "grant_type", "example" }, { "scope", "example" }, }),};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://app.quatlasglobal.com/api/integrations/v1/oauth/token")) .header("Authorization", "Basic <credentials>") .header("Content-Type", "application/x-www-form-urlencoded") .method("POST", HttpRequest.BodyPublishers.ofString("client_id=example&client_secret=example&grant_type=example&scope=example")) .build();HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());System.out.println(response.body());const url = 'https://app.quatlasglobal.com/api/integrations/v1/oauth/token';const options = { method: 'POST', headers: { Authorization: 'Basic <credentials>', 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams({ client_id: 'example', client_secret: 'example', grant_type: 'example', scope: 'example' })};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://app.quatlasglobal.com/api/integrations/v1/oauth/token \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data client_id=example \ --data client_secret=example \ --data grant_type=example \ --data scope=exampleForm-encoded, grant_type=client_credentials. Authenticate with HTTP Basic (client_secret_basic) or the client_id and client_secret fields (client_secret_post): the client id is your key’s prefix, the secret is the key. Returns a bearer token valid for 15 minutes, for Authorization: Bearer on the other routes. Revoking the key refuses its tokens at once. A key whose “direct key allowed” setting is off works here only.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Client_secret_post only: your key’s prefix (qk_… or qk_test_…).
Client_secret_post only: the key itself.
Always client_credentials.
Optional: the scopes wanted, space-separated; at most the key’s own. Default: all of them.
Examplegenerated
client_id=example&client_secret=example&grant_type=example&scope=exampleResponses
Section titled “Responses”OK
object
The bearer token for Authorization: Bearer on the Integration API.
Seconds the token is valid for (900).
The scopes granted, space-separated.
Always Bearer.
Examplegenerated
{ "access_token": "example", "expires_in": 1, "scope": "example", "token_type": "example"}Bad Request
object
Invalid_request, invalid_client, unsupported_grant_type or invalid_scope.
Examplegenerated
{ "error": "example", "error_description": "example"}Unauthorized
object
Invalid_request, invalid_client, unsupported_grant_type or invalid_scope.
Examplegenerated
{ "error": "example", "error_description": "example"}Too Many Requests
object
Examplegenerated
{ "detail": "example", "instance": "example", "status": 1, "title": "example", "type": "example"}