Issue project API key
curl --request POST \
--url https://api.routa.chat/v1/partner/projects/{projectId}/api_keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scopes": [
"messages:write",
"messages:read"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({scopes: ['messages:write', 'messages:read']})
};
fetch('https://api.routa.chat/v1/partner/projects/{projectId}/api_keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.routa.chat/v1/partner/projects/{projectId}/api_keys"
payload = { "scopes": ["messages:write", "messages:read"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.routa.chat/v1/partner/projects/{projectId}/api_keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'scopes' => [
'messages:write',
'messages:read'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.routa.chat/v1/partner/projects/{projectId}/api_keys"
payload := strings.NewReader("{\n \"scopes\": [\n \"messages:write\",\n \"messages:read\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "key_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"project_id": "proj_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"name": "Acme Store",
"key_prefix": "rt_live_abc",
"last_four": "k3xQ",
"scopes": [
"messages:read"
],
"expires_at": "2023-11-07T05:31:56Z",
"ip_allowlist": [
"<string>"
],
"created_at": "2026-09-04T13:22:41.031Z",
"revoked_at": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z",
"secret": "rt_live_..."
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}Projects
Issue project API key
Issues the API key of a project. This key, not the partner key, is what the customer’s traffic uses on /v1/messages, /v1/templates and the other routes. The partner key never sends messages.
The secret is shown only once, in the response. Store it safely.
Requires the api_keys:write scope, which a new partner key does not have. A leaked partner key with this scope can issue keys that send messages for any of your customers. Restrict it to the addresses of your servers and set an expiry.
Ask for the smallest set of scopes that works. The scopes of a project key are listed in Authentication. Unknown values are ignored, and scopes: [] creates a key that cannot do anything.
POST
/
v1
/
partner
/
projects
/
{projectId}
/
api_keys
Issue project API key
curl --request POST \
--url https://api.routa.chat/v1/partner/projects/{projectId}/api_keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scopes": [
"messages:write",
"messages:read"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({scopes: ['messages:write', 'messages:read']})
};
fetch('https://api.routa.chat/v1/partner/projects/{projectId}/api_keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.routa.chat/v1/partner/projects/{projectId}/api_keys"
payload = { "scopes": ["messages:write", "messages:read"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.routa.chat/v1/partner/projects/{projectId}/api_keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'scopes' => [
'messages:write',
'messages:read'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.routa.chat/v1/partner/projects/{projectId}/api_keys"
payload := strings.NewReader("{\n \"scopes\": [\n \"messages:write\",\n \"messages:read\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "key_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"project_id": "proj_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"name": "Acme Store",
"key_prefix": "rt_live_abc",
"last_four": "k3xQ",
"scopes": [
"messages:read"
],
"expires_at": "2023-11-07T05:31:56Z",
"ip_allowlist": [
"<string>"
],
"created_at": "2026-09-04T13:22:41.031Z",
"revoked_at": "2023-11-07T05:31:56Z",
"last_used_at": "2023-11-07T05:31:56Z",
"secret": "rt_live_..."
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "channel_inactive",
"message": "Channel chan_01J8... is not active and cannot send messages.",
"request_id": "req_01J8ZK9M3Q7XABCDEFGHJKMNPQ",
"param": "components.buttons.0.example",
"doc_url": "<string>",
"details": {}
}
}Authorizations
Path Parameters
Body
application/json
Response
Key created. The secret is shown only once