Rotate the calling application's full credential set
curl --request POST \
--url https://staging-switch.yourflexpay.com/api/v1/applications/keys/rotate \
--header 'Authorization: Bearer <token>'import requests
url = "https://staging-switch.yourflexpay.com/api/v1/applications/keys/rotate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://staging-switch.yourflexpay.com/api/v1/applications/keys/rotate', 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://staging-switch.yourflexpay.com/api/v1/applications/keys/rotate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://staging-switch.yourflexpay.com/api/v1/applications/keys/rotate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://staging-switch.yourflexpay.com/api/v1/applications/keys/rotate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging-switch.yourflexpay.com/api/v1/applications/keys/rotate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"errorCode": "<string>",
"data": {
"clientId": "<string>",
"clientSecret": "<string>",
"webhookSecret": "<string>",
"publicJwk": {
"kty": "<string>",
"crv": "<string>",
"x": "<string>",
"y": "<string>",
"use": "<string>",
"alg": "<string>",
"d": "<string>"
},
"privateJwk": {
"kty": "<string>",
"crv": "<string>",
"x": "<string>",
"y": "<string>",
"use": "<string>",
"alg": "<string>",
"d": "<string>"
},
"keyVersion": 1
},
"errors": [
"<string>"
],
"timestamp": "2023-11-07T05:31:56Z"
}{
"success": true,
"message": "<string>",
"errorCode": "<string>",
"data": {
"clientId": "<string>",
"clientSecret": "<string>",
"webhookSecret": "<string>",
"publicJwk": {
"kty": "<string>",
"crv": "<string>",
"x": "<string>",
"y": "<string>",
"use": "<string>",
"alg": "<string>",
"d": "<string>"
},
"privateJwk": {
"kty": "<string>",
"crv": "<string>",
"x": "<string>",
"y": "<string>",
"use": "<string>",
"alg": "<string>",
"d": "<string>"
},
"keyVersion": 1
},
"errors": [
"<string>"
],
"timestamp": "2023-11-07T05:31:56Z"
}{
"success": true,
"message": "<string>",
"errorCode": "<string>",
"data": {
"clientId": "<string>",
"clientSecret": "<string>",
"webhookSecret": "<string>",
"publicJwk": {
"kty": "<string>",
"crv": "<string>",
"x": "<string>",
"y": "<string>",
"use": "<string>",
"alg": "<string>",
"d": "<string>"
},
"privateJwk": {
"kty": "<string>",
"crv": "<string>",
"x": "<string>",
"y": "<string>",
"use": "<string>",
"alg": "<string>",
"d": "<string>"
},
"keyVersion": 1
},
"errors": [
"<string>"
],
"timestamp": "2023-11-07T05:31:56Z"
}Authentication
Rotate the calling application's full credential set
Generates a fresh client secret, webhook signing secret, and EC P-256 keypair for the authenticated application and returns the new credential material once.
This endpoint returns credential material via ApplicationCredentialsResponse.
The clientSecret, webhookSecret, and privateJWK are returned only once - store them securely. After rotation:
- The previous client secret becomes invalid immediately.
- The previous webhook secret becomes invalid immediately.
- Switch will encrypt all outbound webhooks with the new public key.
- Requests encrypted with the old public key will be rejected (Content-Encryption: JWE decryption will fail).
- Allow a brief migration window for in-flight messages before destroying the old private key.
The keyVersion field is incremented on each rotation.
POST
/
v1
/
applications
/
keys
/
rotate
Rotate the calling application's full credential set
curl --request POST \
--url https://staging-switch.yourflexpay.com/api/v1/applications/keys/rotate \
--header 'Authorization: Bearer <token>'import requests
url = "https://staging-switch.yourflexpay.com/api/v1/applications/keys/rotate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://staging-switch.yourflexpay.com/api/v1/applications/keys/rotate', 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://staging-switch.yourflexpay.com/api/v1/applications/keys/rotate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://staging-switch.yourflexpay.com/api/v1/applications/keys/rotate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://staging-switch.yourflexpay.com/api/v1/applications/keys/rotate")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging-switch.yourflexpay.com/api/v1/applications/keys/rotate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"errorCode": "<string>",
"data": {
"clientId": "<string>",
"clientSecret": "<string>",
"webhookSecret": "<string>",
"publicJwk": {
"kty": "<string>",
"crv": "<string>",
"x": "<string>",
"y": "<string>",
"use": "<string>",
"alg": "<string>",
"d": "<string>"
},
"privateJwk": {
"kty": "<string>",
"crv": "<string>",
"x": "<string>",
"y": "<string>",
"use": "<string>",
"alg": "<string>",
"d": "<string>"
},
"keyVersion": 1
},
"errors": [
"<string>"
],
"timestamp": "2023-11-07T05:31:56Z"
}{
"success": true,
"message": "<string>",
"errorCode": "<string>",
"data": {
"clientId": "<string>",
"clientSecret": "<string>",
"webhookSecret": "<string>",
"publicJwk": {
"kty": "<string>",
"crv": "<string>",
"x": "<string>",
"y": "<string>",
"use": "<string>",
"alg": "<string>",
"d": "<string>"
},
"privateJwk": {
"kty": "<string>",
"crv": "<string>",
"x": "<string>",
"y": "<string>",
"use": "<string>",
"alg": "<string>",
"d": "<string>"
},
"keyVersion": 1
},
"errors": [
"<string>"
],
"timestamp": "2023-11-07T05:31:56Z"
}{
"success": true,
"message": "<string>",
"errorCode": "<string>",
"data": {
"clientId": "<string>",
"clientSecret": "<string>",
"webhookSecret": "<string>",
"publicJwk": {
"kty": "<string>",
"crv": "<string>",
"x": "<string>",
"y": "<string>",
"use": "<string>",
"alg": "<string>",
"d": "<string>"
},
"privateJwk": {
"kty": "<string>",
"crv": "<string>",
"x": "<string>",
"y": "<string>",
"use": "<string>",
"alg": "<string>",
"d": "<string>"
},
"keyVersion": 1
},
"errors": [
"<string>"
],
"timestamp": "2023-11-07T05:31:56Z"
}Authorizations
Obtain a token from POST /v1/auth/token using your client_id and client_secret, then enter Bearer <token> here.