Rotate a scoped client's secret
Replaces a confidential client’s secret and returns the new one, once. The replaced secret keeps working for previous_secret_ttl seconds (0 ends it at once, at most 604800, the identity service’s default when omitted). Returns 404 for a client that does not belong to the company and 409 for one with no secret, revoked, or expired. Requires a company admin Bearer token with the developer update permission, for a company whose credentials are scoped clients.
curl --request POST \
--url https://api.fluid.app/api/v2025-06/tokens/clients/{client_id}/rotate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"previous_secret_ttl": 86400
}
'import requests
url = "https://api.fluid.app/api/v2025-06/tokens/clients/{client_id}/rotate"
payload = { "previous_secret_ttl": 86400 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({previous_secret_ttl: 86400})
};
fetch('https://api.fluid.app/api/v2025-06/tokens/clients/{client_id}/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://api.fluid.app/api/v2025-06/tokens/clients/{client_id}/rotate",
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([
'previous_secret_ttl' => 86400
]),
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.fluid.app/api/v2025-06/tokens/clients/{client_id}/rotate"
payload := strings.NewReader("{\n \"previous_secret_ttl\": 86400\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))
}HttpResponse<String> response = Unirest.post("https://api.fluid.app/api/v2025-06/tokens/clients/{client_id}/rotate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"previous_secret_ttl\": 86400\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/v2025-06/tokens/clients/{client_id}/rotate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"previous_secret_ttl\": 86400\n}"
response = http.request(request)
puts response.read_body{
"client": {
"client_id": "fci_kq3vx7m2n9p4r6t8w1y5z0b2c4",
"kind": "confidential",
"name": "Order sync",
"org": "0199a3f2-7c41-7e2b-9d5a-3f6b8c1e4a27",
"scopes": [
"orders:read"
],
"allowed_origins": [],
"grant_types": [
"client_credentials"
],
"created_at": "2026-10-01T12:00:00Z",
"expires_at": null,
"revoked_at": null,
"secret_rotated_at": null,
"previous_secret_expires_at": null
},
"client_secret": "fcs_example-only-shown-once",
"status": 200,
"meta": {
"request_uuid": "8b4e2f71-3c9a-4d6e-b1f0-5a7c9e2d4b18",
"timestamp": "2026-10-01T12:00:00Z"
}
}{
"message": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"pagination": {
"cursor": "<string>",
"limit": 123,
"prev_cursor": "<string>",
"next_cursor": "<string>",
"total_count": 123
}
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"pagination": {
"cursor": "<string>",
"limit": 123,
"prev_cursor": "<string>",
"next_cursor": "<string>",
"total_count": 123
}
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"pagination": {
"cursor": "<string>",
"limit": 123,
"prev_cursor": "<string>",
"next_cursor": "<string>",
"total_count": 123
}
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"pagination": {
"cursor": "<string>",
"limit": 123,
"prev_cursor": "<string>",
"next_cursor": "<string>",
"total_count": 123
}
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"pagination": {
"cursor": "<string>",
"limit": 123,
"prev_cursor": "<string>",
"next_cursor": "<string>",
"total_count": 123
}
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"pagination": {
"cursor": "<string>",
"limit": 123,
"prev_cursor": "<string>",
"next_cursor": "<string>",
"total_count": 123
}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The scoped client's id.
Body
Seconds the replaced secret keeps working.
0 <= x <= 604800Response
Success. Cache-Control is no-store; the secret is never shown again.
A client and, from a create or a rotate of a confidential client, its one-time secret.
A scoped client as the identity service's lifecycle API describes it (ScopedClient in services/identity/api/openapi.yaml), passed through by Rails. It never carries a secret or a digest.
Show child attributes
Show child attributes
Shown once. Absent for a publishable client.
Show child attributes
Show child attributes
curl --request POST \
--url https://api.fluid.app/api/v2025-06/tokens/clients/{client_id}/rotate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"previous_secret_ttl": 86400
}
'import requests
url = "https://api.fluid.app/api/v2025-06/tokens/clients/{client_id}/rotate"
payload = { "previous_secret_ttl": 86400 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({previous_secret_ttl: 86400})
};
fetch('https://api.fluid.app/api/v2025-06/tokens/clients/{client_id}/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://api.fluid.app/api/v2025-06/tokens/clients/{client_id}/rotate",
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([
'previous_secret_ttl' => 86400
]),
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.fluid.app/api/v2025-06/tokens/clients/{client_id}/rotate"
payload := strings.NewReader("{\n \"previous_secret_ttl\": 86400\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))
}HttpResponse<String> response = Unirest.post("https://api.fluid.app/api/v2025-06/tokens/clients/{client_id}/rotate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"previous_secret_ttl\": 86400\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/v2025-06/tokens/clients/{client_id}/rotate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"previous_secret_ttl\": 86400\n}"
response = http.request(request)
puts response.read_body{
"client": {
"client_id": "fci_kq3vx7m2n9p4r6t8w1y5z0b2c4",
"kind": "confidential",
"name": "Order sync",
"org": "0199a3f2-7c41-7e2b-9d5a-3f6b8c1e4a27",
"scopes": [
"orders:read"
],
"allowed_origins": [],
"grant_types": [
"client_credentials"
],
"created_at": "2026-10-01T12:00:00Z",
"expires_at": null,
"revoked_at": null,
"secret_rotated_at": null,
"previous_secret_expires_at": null
},
"client_secret": "fcs_example-only-shown-once",
"status": 200,
"meta": {
"request_uuid": "8b4e2f71-3c9a-4d6e-b1f0-5a7c9e2d4b18",
"timestamp": "2026-10-01T12:00:00Z"
}
}{
"message": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"pagination": {
"cursor": "<string>",
"limit": 123,
"prev_cursor": "<string>",
"next_cursor": "<string>",
"total_count": 123
}
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"pagination": {
"cursor": "<string>",
"limit": 123,
"prev_cursor": "<string>",
"next_cursor": "<string>",
"total_count": 123
}
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"pagination": {
"cursor": "<string>",
"limit": 123,
"prev_cursor": "<string>",
"next_cursor": "<string>",
"total_count": 123
}
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"pagination": {
"cursor": "<string>",
"limit": 123,
"prev_cursor": "<string>",
"next_cursor": "<string>",
"total_count": 123
}
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"pagination": {
"cursor": "<string>",
"limit": 123,
"prev_cursor": "<string>",
"next_cursor": "<string>",
"total_count": 123
}
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"pagination": {
"cursor": "<string>",
"limit": 123,
"prev_cursor": "<string>",
"next_cursor": "<string>",
"total_count": 123
}
}
}