openapi: 3.0.3
info:
title: Stytch B2B Authentication Application Clients API
version: 2.0.0
description: Stytch's B2B API for multi-tenant authentication. Supports Organizations, Members, SSO (SAML/OIDC), Magic Links, OTP, OAuth, Discovery, Sessions, B2B RBAC, SCIM, TOTP, Recovery Codes, Passwords, Impersonation, and the B2B IDP.
contact:
name: Stytch
url: https://stytch.com/docs
license:
name: Proprietary
servers:
- url: https://api.stytch.com
description: Production
- url: https://test.stytch.com
description: Test
tags:
- name: Clients
paths:
/v1/connected_apps/clients/{client_id}/secrets/rotate/start:
post:
summary: Rotatestart
operationId: api_connectedapps_v1_connected_apps_clients_secrets_RotateStart
tags:
- Clients
description: 'Initiate the rotation of a Connected App client secret. After this endpoint is called, both the client''s `client_secret` and `next_client_secret` will be valid. To complete the secret rotation flow, update all usages of `client_secret` to `next_client_secret` and call the Rotate Secret Endpoint to complete the flow.
Secret rotation can be cancelled using the Cancel Secret Rotation endpoint.
**Important:** This is the only time you will be able to view the generated `next_client_secret` in the API response. Stytch stores a hash of the `next_client_secret` and cannot recover the value if lost. Be sure to persist the `next_client_secret` in a secure location. If the `next_client_secret` is lost, you will need to trigger a secret rotation flow to receive another one.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_connectedapps_v1_connected_apps_clients_secrets_RotateStartRequest'
parameters:
- name: client_id
in: path
required: true
schema:
type: string
description: The ID of the client.
description: The ID of the client.
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_connectedapps_v1_connected_apps_clients_secrets_RotateStartResponse'
'400':
description: Bad request
'401':
description: Unauthorized
content:
application/json:
example:
status_code: 401
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: unauthorized_credentials
error_message: Unauthorized credentials.
error_url: https://stytch.com/docs/api/errors/401
'429':
description: Too Many Requests
content:
application/json:
example:
status_code: 429
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: too_many_requests
error_message: Too many requests have been made.
error_url: https://stytch.com/docs/api/errors/429
'500':
description: Internal server error
content:
application/json:
example:
status_code: 500
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: internal_server_error
error_message: Oops, something seems to have gone wrong, please reach out to support@stytch.com to let us know what went wrong.
error_url: https://stytch.com/docs/api/errors/500
x-code-samples:
- lang: csharp
label: C#
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate/start\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n client_id: \"${exampleM2MClientID}\",\n};\n\nclient.ConnectedApp.Clients.Secrets.RotateStart(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate/start\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/b2bstytchapi\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/connectedapps/clients/secrets\"\n)\n\nfunc main() {\n\tclient, err := b2bstytchapi.NewClient(\n\t\t\"${projectId}\",\n\t\t\"${secret}\",\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"error instantiating client: %v\", err)\n\t}\n\n\tparams := &secrets.RotateStartParams{\n\t\tClientID: \"${exampleM2MClientID}\",\n\t}\n\n\tresp, err := client.ConnectedApp.Clients.Secrets.RotateStart(context.Background(), params)\n\tif err != nil {\n\t\tlog.Fatalf(\"error in method call: %v\", err)\n\t}\n\n\tlog.Println(resp)\n}\n"
- lang: java
label: Java
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate/start\npackage com.example;\n\nimport com.stytch.java.b2b.StytchB2BClient;\nimport com.stytch.java.common.StytchResult;\nimport com.stytch.java.consumer.models.connectedappsclientssecrets.RotateStartRequest;\n\npublic class Main {\n public static void main(String[] args) {\n StytchB2BClient.configure(\"${projectId}\", \"${secret}\");\n\n RotateStartRequest params = new RotateStartRequest();\n params.setClientId(\"${exampleM2MClientID}\");\n\n Object result = StytchB2BClient.getConnectedApp().getClients().getSecrets().rotateStart(params);\n if (result instanceof StytchResult.Success) {\n System.out.println(((StytchResult.Success) result).getValue());\n } else {\n System.out.println(((StytchResult.Error) result).getException());\n }\n }\n}"
- lang: kotlin
label: Kotlin
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate/start\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.consumer.models.connectedappsclientssecrets.RotateStartRequest\n\nfun main() {\n StytchB2BClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchB2BClient.connectedApp.clients.secrets.rotateStart(\n RotateStartRequest(\n clientId = \"${exampleM2MClientID}\",\n ),\n )\n ) {\n is StytchResult.Success -> println(result.value)\n is StytchResult.Error -> println(result.exception)\n }\n}\n"
- lang: javascript
label: Node.js
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate/start\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n client_id: \"${exampleM2MClientID}\",\n};\n\nclient.connectedApp.clients.secrets.rotateStart(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->connected_app->clients->secrets->rotate_start([\n 'client_id' => '${exampleM2MClientID}',\n]);"
- lang: python
label: Python
source: "# POST /v1/connected_apps/clients/{client_id}/secrets/rotate/start\nfrom stytch import B2BClient\n\nclient = B2BClient(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.connected_app.clients.secrets.rotate_start(\n client_id=\"${exampleM2MClientID}\",\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# POST /v1/connected_apps/clients/{client_id}/secrets/rotate/start\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.connected_app.clients.secrets.rotate_start(\n client_id: \"${exampleM2MClientID}\"\n \n)\n\nputs resp"
- lang: rust
label: Rust
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate/start\nuse stytch::b2b::client::Client;\nuse stytch::consumer::connected_apps_clients_secrets::RotateStartRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.connected_app.clients.secrets.rotate_start(\n RotateStartRequest{\n client_id: \"${exampleM2MClientID}\",\n ..Default::default()\n }\n ).await;\n println!(\"The response is {:?}\", resp);\n}"
- lang: bash
label: cURL
source: "# POST /v1/connected_apps/clients/{client_id}/secrets/rotate/start\ncurl --request POST \\\n --url https://test.stytch.com/v1/connected_apps/clients/${exampleM2MClientID}/secrets/rotate/start \\\n -u '${projectId}:${secret}' \\\n -H 'Content-Type: application/json'"
/v1/connected_apps/clients/{client_id}/secrets/rotate/cancel:
post:
summary: Rotatecancel
operationId: api_connectedapps_v1_connected_apps_clients_secrets_RotateCancel
tags:
- Clients
description: Cancel the rotation of a Connected App client secret started with the Start Secret Rotation Endpoint. After this endpoint is called, the client's `next_client_secret` is discarded and only the original `client_secret` will be valid.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_connectedapps_v1_connected_apps_clients_secrets_RotateCancelRequest'
parameters:
- name: client_id
in: path
required: true
schema:
type: string
description: The ID of the client.
description: The ID of the client.
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_connectedapps_v1_connected_apps_clients_secrets_RotateCancelResponse'
'400':
description: Bad request
'401':
description: Unauthorized
content:
application/json:
example:
status_code: 401
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: unauthorized_credentials
error_message: Unauthorized credentials.
error_url: https://stytch.com/docs/api/errors/401
'429':
description: Too Many Requests
content:
application/json:
example:
status_code: 429
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: too_many_requests
error_message: Too many requests have been made.
error_url: https://stytch.com/docs/api/errors/429
'500':
description: Internal server error
content:
application/json:
example:
status_code: 500
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: internal_server_error
error_message: Oops, something seems to have gone wrong, please reach out to support@stytch.com to let us know what went wrong.
error_url: https://stytch.com/docs/api/errors/500
x-code-samples:
- lang: csharp
label: C#
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate/cancel\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n client_id: \"${exampleM2MClientID}\",\n};\n\nclient.ConnectedApp.Clients.Secrets.RotateCancel(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate/cancel\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/b2bstytchapi\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/connectedapps/clients/secrets\"\n)\n\nfunc main() {\n\tclient, err := b2bstytchapi.NewClient(\n\t\t\"${projectId}\",\n\t\t\"${secret}\",\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"error instantiating client: %v\", err)\n\t}\n\n\tparams := &secrets.RotateCancelParams{\n\t\tClientID: \"${exampleM2MClientID}\",\n\t}\n\n\tresp, err := client.ConnectedApp.Clients.Secrets.RotateCancel(context.Background(), params)\n\tif err != nil {\n\t\tlog.Fatalf(\"error in method call: %v\", err)\n\t}\n\n\tlog.Println(resp)\n}\n"
- lang: java
label: Java
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate/cancel\npackage com.example;\n\nimport com.stytch.java.b2b.StytchB2BClient;\nimport com.stytch.java.common.StytchResult;\nimport com.stytch.java.consumer.models.connectedappsclientssecrets.RotateCancelRequest;\n\npublic class Main {\n public static void main(String[] args) {\n StytchB2BClient.configure(\"${projectId}\", \"${secret}\");\n\n RotateCancelRequest params = new RotateCancelRequest();\n params.setClientId(\"${exampleM2MClientID}\");\n\n Object result = StytchB2BClient.getConnectedApp().getClients().getSecrets().rotateCancel(params);\n if (result instanceof StytchResult.Success) {\n System.out.println(((StytchResult.Success) result).getValue());\n } else {\n System.out.println(((StytchResult.Error) result).getException());\n }\n }\n}"
- lang: kotlin
label: Kotlin
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate/cancel\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.consumer.models.connectedappsclientssecrets.RotateCancelRequest\n\nfun main() {\n StytchB2BClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchB2BClient.connectedApp.clients.secrets.rotateCancel(\n RotateCancelRequest(\n clientId = \"${exampleM2MClientID}\",\n ),\n )\n ) {\n is StytchResult.Success -> println(result.value)\n is StytchResult.Error -> println(result.exception)\n }\n}\n"
- lang: javascript
label: Node.js
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate/cancel\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n client_id: \"${exampleM2MClientID}\",\n};\n\nclient.connectedApp.clients.secrets.rotateCancel(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->connected_app->clients->secrets->rotate_cancel([\n 'client_id' => '${exampleM2MClientID}',\n]);"
- lang: python
label: Python
source: "# POST /v1/connected_apps/clients/{client_id}/secrets/rotate/cancel\nfrom stytch import B2BClient\n\nclient = B2BClient(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.connected_app.clients.secrets.rotate_cancel(\n client_id=\"${exampleM2MClientID}\",\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# POST /v1/connected_apps/clients/{client_id}/secrets/rotate/cancel\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.connected_app.clients.secrets.rotate_cancel(\n client_id: \"${exampleM2MClientID}\"\n \n)\n\nputs resp"
- lang: rust
label: Rust
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate/cancel\nuse stytch::b2b::client::Client;\nuse stytch::consumer::connected_apps_clients_secrets::RotateCancelRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.connected_app.clients.secrets.rotate_cancel(\n RotateCancelRequest{\n client_id: \"${exampleM2MClientID}\",\n ..Default::default()\n }\n ).await;\n println!(\"The response is {:?}\", resp);\n}"
- lang: bash
label: cURL
source: "# POST /v1/connected_apps/clients/{client_id}/secrets/rotate/cancel\ncurl --request POST \\\n --url https://test.stytch.com/v1/connected_apps/clients/${exampleM2MClientID}/secrets/rotate/cancel \\\n -u '${projectId}:${secret}' \\\n -H 'Content-Type: application/json'"
/v1/connected_apps/clients/{client_id}/secrets/rotate:
post:
summary: Rotate
operationId: api_connectedapps_v1_connected_apps_clients_secrets_Rotate
tags:
- Clients
description: 'Complete the rotation of a Connected App client secret started with the Rotate Secret Start Endpoint.
After this endpoint is called, the client''s `next_client_secret` becomes its `client_secret` and the previous `client_secret` will no longer be valid.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_connectedapps_v1_connected_apps_clients_secrets_RotateRequest'
parameters:
- name: client_id
in: path
required: true
schema:
type: string
description: The ID of the client.
description: The ID of the client.
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_connectedapps_v1_connected_apps_clients_secrets_RotateResponse'
'400':
description: Bad request
'401':
description: Unauthorized
content:
application/json:
example:
status_code: 401
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: unauthorized_credentials
error_message: Unauthorized credentials.
error_url: https://stytch.com/docs/api/errors/401
'429':
description: Too Many Requests
content:
application/json:
example:
status_code: 429
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: too_many_requests
error_message: Too many requests have been made.
error_url: https://stytch.com/docs/api/errors/429
'500':
description: Internal server error
content:
application/json:
example:
status_code: 500
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: internal_server_error
error_message: Oops, something seems to have gone wrong, please reach out to support@stytch.com to let us know what went wrong.
error_url: https://stytch.com/docs/api/errors/500
x-code-samples:
- lang: csharp
label: C#
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n client_id: \"${exampleM2MClientID}\",\n};\n\nclient.ConnectedApp.Clients.Secrets.Rotate(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/b2bstytchapi\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/connectedapps/clients/secrets\"\n)\n\nfunc main() {\n\tclient, err := b2bstytchapi.NewClient(\n\t\t\"${projectId}\",\n\t\t\"${secret}\",\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"error instantiating client: %v\", err)\n\t}\n\n\tparams := &secrets.RotateParams{\n\t\tClientID: \"${exampleM2MClientID}\",\n\t}\n\n\tresp, err := client.ConnectedApp.Clients.Secrets.Rotate(context.Background(), params)\n\tif err != nil {\n\t\tlog.Fatalf(\"error in method call: %v\", err)\n\t}\n\n\tlog.Println(resp)\n}\n"
- lang: java
label: Java
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate\npackage com.example;\n\nimport com.stytch.java.b2b.StytchB2BClient;\nimport com.stytch.java.common.StytchResult;\nimport com.stytch.java.consumer.models.connectedappsclientssecrets.RotateRequest;\n\npublic class Main {\n public static void main(String[] args) {\n StytchB2BClient.configure(\"${projectId}\", \"${secret}\");\n\n RotateRequest params = new RotateRequest();\n params.setClientId(\"${exampleM2MClientID}\");\n\n Object result = StytchB2BClient.getConnectedApp().getClients().getSecrets().rotate(params);\n if (result instanceof StytchResult.Success) {\n System.out.println(((StytchResult.Success) result).getValue());\n } else {\n System.out.println(((StytchResult.Error) result).getException());\n }\n }\n}"
- lang: kotlin
label: Kotlin
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.consumer.models.connectedappsclientssecrets.RotateRequest\n\nfun main() {\n StytchB2BClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchB2BClient.connectedApp.clients.secrets.rotate(\n RotateRequest(\n clientId = \"${exampleM2MClientID}\",\n ),\n )\n ) {\n is StytchResult.Success -> println(result.value)\n is StytchResult.Error -> println(result.exception)\n }\n}\n"
- lang: javascript
label: Node.js
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n client_id: \"${exampleM2MClientID}\",\n};\n\nclient.connectedApp.clients.secrets.rotate(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->connected_app->clients->secrets->rotate([\n 'client_id' => '${exampleM2MClientID}',\n]);"
- lang: python
label: Python
source: "# POST /v1/connected_apps/clients/{client_id}/secrets/rotate\nfrom stytch import B2BClient\n\nclient = B2BClient(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.connected_app.clients.secrets.rotate(\n client_id=\"${exampleM2MClientID}\",\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# POST /v1/connected_apps/clients/{client_id}/secrets/rotate\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.connected_app.clients.secrets.rotate(\n client_id: \"${exampleM2MClientID}\"\n \n)\n\nputs resp"
- lang: rust
label: Rust
source: "// POST /v1/connected_apps/clients/{client_id}/secrets/rotate\nuse stytch::b2b::client::Client;\nuse stytch::consumer::connected_apps_clients_secrets::RotateRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.connected_app.clients.secrets.rotate(\n RotateRequest{\n client_id: \"${exampleM2MClientID}\",\n ..Default::default()\n }\n ).await;\n println!(\"The response is {:?}\", resp);\n}"
- lang: bash
label: cURL
source: "# POST /v1/connected_apps/clients/{client_id}/secrets/rotate\ncurl --request POST \\\n --url https://test.stytch.com/v1/connected_apps/clients/${exampleM2MClientID}/secrets/rotate \\\n -u '${projectId}:${secret}' \\\n -H 'Content-Type: application/json'"
/v1/m2m/clients/{client_id}/secrets/rotate/start:
post:
summary: Rotatestart
operationId: api_m2m_v1_m2m_clients_secrets_RotateStart
tags:
- Clients
description: 'Initiate the rotation of an M2M client secret. After this endpoint is called, both the client''s `client_secret` and `next_client_secret` will be valid. To complete the secret rotation flow, update all usages of `client_secret` to `next_client_secret` and call the [Rotate Secret Endpoint](https://stytch.com/docs/b2b/api/m2m-rotate-secret)[Rotate Secret Endpoint](https://stytch.com/docs/api/m2m-rotate-secret) to complete the flow.Secret rotation can be cancelled using the [Rotate Cancel Endpoint](https://stytch.com/docs/b2b/api/m2m-rotate-secret-cancel)[Rotate Cancel Endpoint](https://stytch.com/docs/api/m2m-rotate-secret-cancel).
**Important:** This is the only time you will be able to view the generated `next_client_secret` in the API response. Stytch stores a hash of the `next_client_secret` and cannot recover the value if lost. Be sure to persist the `next_client_secret` in a secure location. If the `next_client_secret` is lost, you will need to trigger a secret rotation flow to receive another one.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_m2m_v1_m2m_clients_secrets_RotateStartRequest'
parameters:
- name: client_id
in: path
required: true
schema:
type: string
description: The ID of the client.
description: The ID of the client.
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_m2m_v1_m2m_clients_secrets_RotateStartResponse'
'400':
description: Bad request
'401':
description: Unauthorized
content:
application/json:
example:
status_code: 401
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: unauthorized_credentials
error_message: Unauthorized credentials.
error_url: https://stytch.com/docs/api/errors/401
'429':
description: Too Many Requests
content:
application/json:
example:
status_code: 429
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: too_many_requests
error_message: Too many requests have been made.
error_url: https://stytch.com/docs/api/errors/429
'500':
description: Internal server error
content:
application/json:
example:
status_code: 500
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: internal_server_error
error_message: Oops, something seems to have gone wrong, please reach out to support@stytch.com to let us know what went wrong.
error_url: https://stytch.com/docs/api/errors/500
x-code-samples:
- lang: csharp
label: C#
source: "// POST /v1/m2m/clients/{client_id}/secrets/rotate/start\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n client_id: \"${exampleM2MClientID}\",\n};\n\nclient.M2M.Clients.Secrets.RotateStart(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// POST /v1/m2m/clients/{client_id}/secrets/rotate/start\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/b2bstytchapi\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/m2m/clients/secrets\"\n)\n\nfunc main() {\n\tclient, err := b2bstytchapi.NewClient(\n\t\t\"${projectId}\",\n\t\t\"${secret}\",\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"error instantiating client: %v\", err)\n\t}\n\n\tparams := &secrets.RotateStartParams{\n\t\tClientID: \"${exampleM2MClientID}\",\n\t}\n\n\tresp, err := client.M2M.Clients.Secrets.RotateStart(context.Background(), params)\n\tif err != nil {\n\t\tlog.Fatalf(\"error in method call: %v\", err)\n\t}\n\n\tlog.Println(resp)\n}\n"
- lang: java
label: Java
source: "// POST /v1/m2m/clients/{client_id}/secrets/rotate/start\npackage com.example;\n\nimport com.stytch.java.b2b.StytchB2BClient;\nimport com.stytch.java.common.StytchResult;\nimport com.stytch.java.consumer.models.m2mclientssecrets.RotateStartRequest;\n\npublic class Main {\n public static void main(String[] args) {\n StytchB2BClient.configure(\"${projectId}\", \"${secret}\");\n\n RotateStartRequest params = new RotateStartRequest();\n params.setClientId(\"${exampleM2MClientID}\");\n\n Object result = StytchB2BClient.getM2M().getClients().getSecrets().rotateStart(params);\n if (result instanceof StytchResult.Success) {\n System.out.println(((StytchResult.Success) result).getValue());\n } else {\n System.out.println(((StytchResult.Error) result).getException());\n }\n }\n}"
- lang: kotlin
label: Kotlin
source: "// POST /v1/m2m/clients/{client_id}/secrets/rotate/start\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.consumer.models.m2mclientssecrets.RotateStartRequest\n\nfun main() {\n StytchB2BClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchB2BClient.m2m.clients.secrets.rotateStart(\n RotateStartRequest(\n clientId = \"${exampleM2MClientID}\",\n ),\n )\n ) {\n is StytchResult.Success -> println(result.value)\n is StytchResult.Error -> println(result.exception)\n }\n}\n"
- lang: javascript
label: Node.js
source: "// POST /v1/m2m/clients/{client_id}/secrets/rotate/start\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n client_id: \"${exampleM2MClientID}\",\n};\n\nclient.m2m.clients.secrets.rotateStart(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->m2m->clients->secrets->rotate_start([\n 'client_id' => '${exampleM2MClientID}',\n]);"
- lang: python
label: Python
source: "# POST /v1/m2m/clients/{client_id}/secrets/rotate/start\nfrom stytch import B2BClient\n\nclient = B2BClient(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.m2m.clients.secrets.rotate_start(\n client_id=\"${exampleM2MClientID}\",\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# POST /v1/m2m/clients/{client_id}/secrets/rotate/start\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.m2m.clients.secrets.rotate_start(\n client_id: \"${exampleM2MClientID}\"\n \n)\n\nputs resp"
- lang: rust
label: Rust
source: "// POST /v1/m2m/clients/{client_id}/secrets/rotate/start\nuse stytch::b2b::client::Client;\nuse stytch::consumer::m2m_clients_secrets::RotateStartRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.m2m.clients.secrets.rotate_start(\n RotateStartRequest{\n client_id: \"${exampleM2MClientID}\",\n ..Default::default()\n }\n ).await;\n println!(\"The response is {:?}\", resp);\n}"
- lang: bash
label: cURL
source: "# POST /v1/m2m/clients/{client_id}/secrets/rotate/start\ncurl --request POST \\\n --url https://test.stytc
# --- truncated at 32 KB (61 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/stytch/refs/heads/main/openapi/stytch-clients-api-openapi.yml