Update API-key restrictions
curl --request PATCH \
--url https://api.sandbox.rails.wayex.com/v1/api-keys/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scopes": [],
"allowedIps": [
"<string>"
]
}
'import requests
url = "https://api.sandbox.rails.wayex.com/v1/api-keys/{id}"
payload = {
"scopes": [],
"allowedIps": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({scopes: [], allowedIps: ['<string>']})
};
fetch('https://api.sandbox.rails.wayex.com/v1/api-keys/{id}', 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.sandbox.rails.wayex.com/v1/api-keys/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'scopes' => [
],
'allowedIps' => [
'<string>'
]
]),
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.sandbox.rails.wayex.com/v1/api-keys/{id}"
payload := strings.NewReader("{\n \"scopes\": [],\n \"allowedIps\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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))
}HttpResponse<String> response = Unirest.patch("https://api.sandbox.rails.wayex.com/v1/api-keys/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scopes\": [],\n \"allowedIps\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.rails.wayex.com/v1/api-keys/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"scopes\": [],\n \"allowedIps\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"counterpartyId": "<string>",
"kind": "secret",
"name": "<string>",
"maskedKey": "<string>",
"lastFour": "<string>",
"status": "active",
"createdAt": "2023-11-07T05:31:56Z",
"revokedAt": "2023-11-07T05:31:56Z",
"rotatedToId": "<string>",
"scopes": [
"customers:read"
],
"allowedIps": [
"<string>"
]
}Webhooks and account administration
Update API-key restrictions
Changes supported restrictions on an existing API key.
PATCH
/
v1
/
api-keys
/
{id}
Update API-key restrictions
curl --request PATCH \
--url https://api.sandbox.rails.wayex.com/v1/api-keys/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"scopes": [],
"allowedIps": [
"<string>"
]
}
'import requests
url = "https://api.sandbox.rails.wayex.com/v1/api-keys/{id}"
payload = {
"scopes": [],
"allowedIps": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({scopes: [], allowedIps: ['<string>']})
};
fetch('https://api.sandbox.rails.wayex.com/v1/api-keys/{id}', 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.sandbox.rails.wayex.com/v1/api-keys/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'scopes' => [
],
'allowedIps' => [
'<string>'
]
]),
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.sandbox.rails.wayex.com/v1/api-keys/{id}"
payload := strings.NewReader("{\n \"scopes\": [],\n \"allowedIps\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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))
}HttpResponse<String> response = Unirest.patch("https://api.sandbox.rails.wayex.com/v1/api-keys/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"scopes\": [],\n \"allowedIps\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.rails.wayex.com/v1/api-keys/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"scopes\": [],\n \"allowedIps\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"counterpartyId": "<string>",
"kind": "secret",
"name": "<string>",
"maskedKey": "<string>",
"lastFour": "<string>",
"status": "active",
"createdAt": "2023-11-07T05:31:56Z",
"revokedAt": "2023-11-07T05:31:56Z",
"rotatedToId": "<string>",
"scopes": [
"customers:read"
],
"allowedIps": [
"<string>"
]
}What this endpoint does
Changes supported restrictions on an existing API key.When to use it
Use it to reduce or adjust access without issuing another key.Before you call
Manage keys from a console session with a recent second-factor (MFA) confirmation — a request authenticated only with an API key is refused with403 step_up_required — and pass a key ID owned by the same tenant account.
Money and balance effect
This changes a resource or configuration but does not directly reserve, debit, credit, or settle wallet money.States and completion
A successful response makes the new restrictions effective for later requests. Existing requests are not replayed.Safe retries
PATCH does not use anIdempotency-Key. After an unknown response, list the key and compare its restrictions before retrying the identical update.
Read API keys for the complete workflow.Authorizations
BearerApiKey
Send the same Wayex API key as Authorization: Bearer <key>.
Path Parameters
Body
application/json
Required array length:
1 - 21 elementsAvailable options:
customers:read, customers:write, routes:read, routes:write, transfers:read, transfers:write, treasury:read, treasury:write, rates:read, webhooks:read, webhooks:write, fees:read, fees:write, keys:read, keys:write, settings:read, settings:write, team:read, team:write Required array length:
1 - 50 elementsRequired string length:
1 - 49Pattern:
^[0-9a-fA-F:.]+(\/\d{1,3})?$Response
The updated key.
Minimum string length:
1Minimum string length:
1Available options:
secret, publishable Minimum string length:
1Minimum string length:
1Available options:
active, revoked Minimum string length:
1Available options:
customers:read, customers:write, routes:read, routes:write, transfers:read, transfers:write, treasury:read, treasury:write, rates:read, webhooks:read, webhooks:write, fees:read, fees:write, keys:read, keys:write, settings:read, settings:write, team:read, team:write Required string length:
1 - 49Pattern:
^[0-9a-fA-F:.]+(\/\d{1,3})?$
