Skip to main content
POST
/
v1
/
aggregators
/
{raast-aggregator-id}
/
keys
Create Access Key
curl --request POST \
  --url https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/keys \
  --header 'Content-Type: application/json' \
  --header 'X-SFPY-AGGREGATOR-SECRET-KEY: <api-key>' \
  --data '
{
  "is_active": true,
  "name": "Developer Access Key"
}
'
import requests

url = "https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/keys"

payload = {
"is_active": True,
"name": "Developer Access Key"
}
headers = {
"X-SFPY-AGGREGATOR-SECRET-KEY": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {
'X-SFPY-AGGREGATOR-SECRET-KEY': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({is_active: true, name: 'Developer Access Key'})
};

fetch('https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/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([
'is_active' => true,
'name' => 'Developer Access Key'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SFPY-AGGREGATOR-SECRET-KEY: <api-key>"
],
]);

$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.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/keys"

payload := strings.NewReader("{\n \"is_active\": true,\n \"name\": \"Developer Access Key\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-SFPY-AGGREGATOR-SECRET-KEY", "<api-key>")
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))

}
HttpResponse<String> response = Unirest.post("https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/keys")
.header("X-SFPY-AGGREGATOR-SECRET-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"is_active\": true,\n \"name\": \"Developer Access Key\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/keys")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-SFPY-AGGREGATOR-SECRET-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"is_active\": true,\n \"name\": \"Developer Access Key\"\n}"

response = http.request(request)
puts response.read_body
{
  "api_version": "v1",
  "data": {
    "id": "ak_cf0f7821-32f5-4c66-8e86-0d5e2bb8b6b9",
    "token": "ak_tok_b758ad9a",
    "key_id": "key_live_a31b23f0",
    "aggregator_id": "agg_2288490a-2176-4de5-b373-0ffb6f8e2e6e",
    "is_active": true,
    "name": "Developer Access Key",
    "secret": "sk_live_GZc5k9mT0n",
    "created_at": "2025-05-19T11:19:12.000Z",
    "updated_at": "2025-05-19T11:19:12.000Z"
  }
}
{
"api_version": "v1",
"error": {
"code": "error.unauthorized_access",
"message": "partner access key is required in request header"
}
}
{
"api_version": "v1",
"error": {
"code": "error.internal_server_error",
"message": "rpc error code Internal desc = something went wrong"
}
}

Authorizations

X-SFPY-AGGREGATOR-SECRET-KEY
string
header
required

Path Parameters

raast-aggregator-id
string
required

The unique identifier for the aggregator

Example:

"agg_2288490a-2176-4de5-b373-0ffb6f8e2e6e"

Body

application/json

Request to create a new access key

Defines the attributes required to create a new access key

is_active
boolean
required

Indicates whether the newly created access key should be enabled immediately

Example:

true

name
string
required

Human-readable label that helps distinguish this access key

Example:

"Developer Access Key"

Response

This response contains details of an access key

Standard response structure for successful operations

api_version
string

The current version of the API spec

Example:

"v1"

data
object

Newly created access key resource