Code Samples #
Copy
curl --request POST \
--url 'https://api.taskflow.example.com/v2/auth/token' \
--header 'Content-Type: application/json' \
--data '{
"client_id": "string",
"client_secret": "string"
}'
const response = await fetch('https://api.taskflow.example.com/v2/auth/token', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"client_id": "string",
"client_secret": "string"
})
});
const data = await response.json();
console.log(data);
import requests
headers = {
"Content-Type": "application/json"
}
payload = {
"client_id": "string",
"client_secret": "string"
}
response = requests.post("https://api.taskflow.example.com/v2/auth/token", headers=headers, json=payload)
print(response.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.taskflow.example.com/v2/auth/token',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => '{
"client_id": "string",
"client_secret": "string"
}',
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
using System.Net.Http;
using System.Text;
var client = new HttpClient();
var request = new HttpRequestMessage(new HttpMethod("POST"), "https://api.taskflow.example.com/v2/auth/token");
request.Content = new StringContent(@"{
""client_id"": ""string"",
""client_secret"": ""string""
}", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
import java.net.URI;
import java.net.http.*;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.taskflow.example.com/v2/auth/token"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("""
{
"client_id": "string",
"client_secret": "string"
}
"""))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Response #
Copy
{
"access_token": "string",
"expires_in": 1
}
{
"code": "string",
"message": "string"
}
Request Body #
Content type: application/json — required
| Field | Type | Required | Description |
|---|---|---|---|
client_id | string | Required | |
client_secret | string | Required |
Example request
Copy
{
"client_id": "string",
"client_secret": "string"
}
Responses #
200 — Token issued #
| Field | Type | Required | Description |
|---|---|---|---|
access_token | string | Optional | |
expires_in | integer | Optional | Seconds until expiry |
Example 200 response
Copy
{
"access_token": "string",
"expires_in": 1
}
401 — Missing or invalid credentials #
| Field | Type | Required | Description |
|---|---|---|---|
code | string | Required | |
message | string | Required |
Example 401 response
Copy
{
"code": "string",
"message": "string"
}