openapi: 3.0.3
info:
title: Stytch B2B Authentication Application WebAuthn 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: WebAuthn
paths:
/v1/webauthn/register/start:
post:
summary: Registerstart
operationId: api_webauthn_v1_RegisterStart
tags:
- WebAuthn
description: "Initiate the process of creating a new Passkey or WebAuthn registration. \n\nTo optimize for Passkeys, set the `return_passkey_credential_options` field to `true`.\n\nAfter calling this endpoint, the browser will need to call [navigator.credentials.create()](https://www.w3.org/TR/webauthn-2/#sctn-createCredential) with the data from [public_key_credential_creation_options](https://w3c.github.io/webauthn/#dictionary-makecredentialoptions) passed to the [navigator.credentials.create()](https://www.w3.org/TR/webauthn-2/#sctn-createCredential) request via the public key argument.\n\nWhen using built-in browser methods like `navigator.credentials.create()`, set the `use_base64_url_encoding` option to `true`.\n\nSee our [WebAuthn setup guide](https://stytch.com/docs/guides/webauthn/api) for additional usage instructions and example code."
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_webauthn_v1_RegisterStartRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_webauthn_v1_RegisterStartResponse'
'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/webauthn/register/start\nconst stytch = require('stytch');\n\nconst client = new stytch.Client({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n user_id: \"${userId}\",\n domain: \"${exampleDomain}\",\n};\n\nclient.WebAuthn.RegisterStart(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// POST /v1/webauthn/register/start\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/stytchapi\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/webauthn\"\n)\n\nfunc main() {\n\tclient, err := stytchapi.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 := &webauthn.RegisterStartParams{\n\t\tUserID: \"${userId}\",\n\t\tDomain: \"${exampleDomain}\",\n\t}\n\n\tresp, err := client.WebAuthn.RegisterStart(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/webauthn/register/start\npackage com.example;\n\nimport com.stytch.java.common.StytchResult;\nimport com.stytch.java.consumer.models.webauthn.RegisterStartRequest;\nimport com.stytch.java.consumer.StytchClient;\n\npublic class Main {\n public static void main(String[] args) {\n StytchClient.configure(\"${projectId}\", \"${secret}\");\n\n RegisterStartRequest params = new RegisterStartRequest();\n params.setUserId(\"${userId}\");\n params.setDomain(\"${exampleDomain}\");\n\n Object result = StytchClient.getWebAuthn().registerStart(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/webauthn/register/start\npackage com.example\n\nimport com.stytch.java.consumer.StytchClient\nimport com.stytch.java.consumer.models.webauthn.RegisterStartRequest\n\nfun main() {\n StytchClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchClient.webauthn.registerStart(\n RegisterStartRequest(\n userId = \"${userId}\",\n domain = \"${exampleDomain}\",\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/webauthn/register/start\nconst stytch = require('stytch');\n\nconst client = new stytch.Client({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n user_id: \"${userId}\",\n domain: \"${exampleDomain}\",\n};\n\nclient.webauthn.registerStart(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->webauthn->register_start([\n 'user_id' => '${userId}',\n 'domain' => '${exampleDomain}',\n]);"
- lang: python
label: Python
source: "# POST /v1/webauthn/register/start\nfrom stytch import Client\n\nclient = Client(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.webauthn.register_start(\n user_id=\"${userId}\",\n domain=\"${exampleDomain}\",\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# POST /v1/webauthn/register/start\nrequire 'stytch'\n\nclient = Stytch::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.webauthn.register_start(\n user_id: \"${userId}\",\n domain: \"${exampleDomain}\"\n \n)\n\nputs resp"
- lang: rust
label: Rust
source: "// POST /v1/webauthn/register/start\nuse stytch::consumer::client::Client;\nuse stytch::consumer::webauthn::RegisterStartRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.webauthn.register_start(\n RegisterStartRequest{\n user_id: \"${userId}\",\n domain: \"${exampleDomain}\",\n ..Default::default()\n }\n ).await;\n println!(\"The response is {:?}\", resp);\n}"
- lang: bash
label: cURL
source: "# POST /v1/webauthn/register/start\ncurl --request POST \\\n --url https://test.stytch.com/v1/webauthn/register/start \\\n -u '${projectId}:${secret}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"user_id\": \"${userId}\",\n \"domain\": \"${exampleDomain}\"\n }'"
/v1/webauthn/register:
post:
summary: Register
operationId: api_webauthn_v1_Register
tags:
- WebAuthn
description: "Complete the creation of a WebAuthn registration by passing the response from the [navigator.credentials.create()](https://www.w3.org/TR/webauthn-2/#sctn-createCredential) request to this endpoint as the `public_key_credential` parameter. \n\nSee our [WebAuthn setup guide](https://stytch.com/docs/guides/webauthn/api) for additional usage instructions and example code."
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_webauthn_v1_RegisterRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_webauthn_v1_RegisterResponse'
'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/webauthn/register\nconst stytch = require('stytch');\n\nconst client = new stytch.Client({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n user_id: \"${userId}\",\n public_key_credential: \"${exampleCreatePublicKeyCredential}\",\n session_duration_minutes: 60,\n};\n\nclient.WebAuthn.Register(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// POST /v1/webauthn/register\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/stytchapi\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/webauthn\"\n)\n\nfunc main() {\n\tclient, err := stytchapi.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 := &webauthn.RegisterParams{\n\t\tUserID: \"${userId}\",\n\t\tPublicKeyCredential: \"${exampleCreatePublicKeyCredential}\",\n\t\tSessionDurationMinutes: 60,\n\t}\n\n\tresp, err := client.WebAuthn.Register(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/webauthn/register\npackage com.example;\n\nimport com.stytch.java.common.StytchResult;\nimport com.stytch.java.consumer.models.webauthn.RegisterRequest;\nimport com.stytch.java.consumer.StytchClient;\n\npublic class Main {\n public static void main(String[] args) {\n StytchClient.configure(\"${projectId}\", \"${secret}\");\n\n RegisterRequest params = new RegisterRequest();\n params.setUserId(\"${userId}\");\n params.setPublicKeyCredential(\"${exampleCreatePublicKeyCredential}\");\n params.setSessionDurationMinutes(60);\n\n Object result = StytchClient.getWebAuthn().register(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/webauthn/register\npackage com.example\n\nimport com.stytch.java.consumer.StytchClient\nimport com.stytch.java.consumer.models.webauthn.RegisterRequest\n\nfun main() {\n StytchClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchClient.webauthn.register(\n RegisterRequest(\n userId = \"${userId}\",\n publicKeyCredential = \"${exampleCreatePublicKeyCredential}\",\n sessionDurationMinutes = 60,\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/webauthn/register\nconst stytch = require('stytch');\n\nconst client = new stytch.Client({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n user_id: \"${userId}\",\n public_key_credential: \"${exampleCreatePublicKeyCredential}\",\n session_duration_minutes: 60,\n};\n\nclient.webauthn.register(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->webauthn->register([\n 'user_id' => '${userId}',\n 'public_key_credential' => '${exampleCreatePublicKeyCredential}',\n 'session_duration_minutes' => 60,\n]);"
- lang: python
label: Python
source: "# POST /v1/webauthn/register\nfrom stytch import Client\n\nclient = Client(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.webauthn.register(\n user_id=\"${userId}\",\n public_key_credential=\"${exampleCreatePublicKeyCredential}\",\n session_duration_minutes=60,\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# POST /v1/webauthn/register\nrequire 'stytch'\n\nclient = Stytch::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.webauthn.register(\n user_id: \"${userId}\",\n public_key_credential: \"${exampleCreatePublicKeyCredential}\",\n session_duration_minutes: 60\n \n)\n\nputs resp"
- lang: rust
label: Rust
source: "// POST /v1/webauthn/register\nuse stytch::consumer::client::Client;\nuse stytch::consumer::webauthn::RegisterRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.webauthn.register(\n RegisterRequest{\n user_id: \"${userId}\",\n public_key_credential: \"${exampleCreatePublicKeyCredential}\",\n session_duration_minutes: 60,\n ..Default::default()\n }\n ).await;\n println!(\"The response is {:?}\", resp);\n}"
- lang: bash
label: cURL
source: "# POST /v1/webauthn/register\ncurl --request POST \\\n --url https://test.stytch.com/v1/webauthn/register \\\n -u '${projectId}:${secret}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"user_id\": \"${userId}\",\n \"public_key_credential\": \"${exampleCreatePublicKeyCredential}\",\n \"session_duration_minutes\": 60\n }'"
/v1/webauthn/authenticate/start:
post:
summary: Authenticatestart
operationId: api_webauthn_v1_AuthenticateStart
tags:
- WebAuthn
description: "Initiate the authentication of a Passkey or WebAuthn registration. \n\nTo optimize for Passkeys, set the `return_passkey_credential_options` field to `true`.\n\nAfter calling this endpoint, the browser will need to call [navigator.credentials.get()](https://www.w3.org/TR/webauthn-2/#sctn-getAssertion) with the data from `public_key_credential_request_options` passed to the [navigator.credentials.get()](https://www.w3.org/TR/webauthn-2/#sctn-getAssertion) request via the public key argument.\n\nWhen using built-in browser methods like `navigator.credentials.get()`, set the `use_base64_url_encoding` option to `true`.\n\nSee our [WebAuthn setup guide](https://stytch.com/docs/guides/webauthn/api) for additional usage instructions and example code."
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_webauthn_v1_AuthenticateStartRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_webauthn_v1_AuthenticateStartResponse'
'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/webauthn/authenticate/start\nconst stytch = require('stytch');\n\nconst client = new stytch.Client({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n domain: \"${exampleDomain}\",\n user_id: \"${userId}\",\n};\n\nclient.WebAuthn.AuthenticateStart(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// POST /v1/webauthn/authenticate/start\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/stytchapi\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/webauthn\"\n)\n\nfunc main() {\n\tclient, err := stytchapi.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 := &webauthn.AuthenticateStartParams{\n\t\tDomain: \"${exampleDomain}\",\n\t\tUserID: \"${userId}\",\n\t}\n\n\tresp, err := client.WebAuthn.AuthenticateStart(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/webauthn/authenticate/start\npackage com.example;\n\nimport com.stytch.java.common.StytchResult;\nimport com.stytch.java.consumer.models.webauthn.AuthenticateStartRequest;\nimport com.stytch.java.consumer.StytchClient;\n\npublic class Main {\n public static void main(String[] args) {\n StytchClient.configure(\"${projectId}\", \"${secret}\");\n\n AuthenticateStartRequest params = new AuthenticateStartRequest();\n params.setDomain(\"${exampleDomain}\");\n params.setUserId(\"${userId}\");\n\n Object result = StytchClient.getWebAuthn().authenticateStart(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/webauthn/authenticate/start\npackage com.example\n\nimport com.stytch.java.consumer.StytchClient\nimport com.stytch.java.consumer.models.webauthn.AuthenticateStartRequest\n\nfun main() {\n StytchClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchClient.webauthn.authenticateStart(\n AuthenticateStartRequest(\n domain = \"${exampleDomain}\",\n userId = \"${userId}\",\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/webauthn/authenticate/start\nconst stytch = require('stytch');\n\nconst client = new stytch.Client({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n domain: \"${exampleDomain}\",\n user_id: \"${userId}\",\n};\n\nclient.webauthn.authenticateStart(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->webauthn->authenticate_start([\n 'domain' => '${exampleDomain}',\n 'user_id' => '${userId}',\n]);"
- lang: python
label: Python
source: "# POST /v1/webauthn/authenticate/start\nfrom stytch import Client\n\nclient = Client(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.webauthn.authenticate_start(\n domain=\"${exampleDomain}\",\n user_id=\"${userId}\",\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# POST /v1/webauthn/authenticate/start\nrequire 'stytch'\n\nclient = Stytch::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.webauthn.authenticate_start(\n domain: \"${exampleDomain}\",\n user_id: \"${userId}\"\n \n)\n\nputs resp"
- lang: rust
label: Rust
source: "// POST /v1/webauthn/authenticate/start\nuse stytch::consumer::client::Client;\nuse stytch::consumer::webauthn::AuthenticateStartRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.webauthn.authenticate_start(\n AuthenticateStartRequest{\n domain: \"${exampleDomain}\",\n user_id: Some(String::from(\"${userId}\")),\n ..Default::default()\n }\n ).await;\n println!(\"The response is {:?}\", resp);\n}"
- lang: bash
label: cURL
source: "# POST /v1/webauthn/authenticate/start\ncurl --request POST \\\n --url https://test.stytch.com/v1/webauthn/authenticate/start \\\n -u '${projectId}:${secret}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"domain\": \"${exampleDomain}\",\n \"user_id\": \"${userId}\"\n }'"
/v1/webauthn/authenticate:
post:
summary: Authenticate
operationId: api_webauthn_v1_Authenticate
tags:
- WebAuthn
description: "Complete the authentication of a Passkey or WebAuthn registration by passing the response from the [navigator.credentials.get()](https://www.w3.org/TR/webauthn-2/#sctn-getAssertion) request to the authenticate endpoint. \n\nSee our [WebAuthn setup guide](https://stytch.com/docs/guides/webauthn/api) for additional usage instructions and example code."
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_webauthn_v1_AuthenticateRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_webauthn_v1_AuthenticateResponse'
'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/webauthn/authenticate\nconst stytch = require('stytch');\n\nconst client = new stytch.Client({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n public_key_credential: \"${exampleGetPublicKeyCredential}\",\n session_duration_minutes: 60,\n};\n\nclient.WebAuthn.Authenticate(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// POST /v1/webauthn/authenticate\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/stytchapi\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/consumer/webauthn\"\n)\n\nfunc main() {\n\tclient, err := stytchapi.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 := &webauthn.AuthenticateParams{\n\t\tPublicKeyCredential: \"${exampleGetPublicKeyCredential}\",\n\t\tSessionDurationMinutes: 60,\n\t}\n\n\tresp, err := client.WebAuthn.Authenticate(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/webauthn/authenticate\npackage com.example;\n\nimport com.stytch.java.common.StytchResult;\nimport com.stytch.java.consumer.models.webauthn.AuthenticateRequest;\nimport com.stytch.java.consumer.StytchClient;\n\npublic class Main {\n public static void main(String[] args) {\n StytchClient.configure(\"${projectId}\", \"${secret}\");\n\n AuthenticateRequest params = new AuthenticateRequest();\n params.setPublicKeyCredential(\"${exampleGetPublicKeyCredential}\");\n params.setSessionDurationMinutes(60);\n\n Object result = StytchClient.getWebAuthn().authenticate(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/webauthn/authenticate\npackage com.example\n\nimport com.stytch.java.consumer.StytchClient\nimport com.stytch.java.consumer.models.webauthn.AuthenticateRequest\n\nfun main() {\n StytchClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchClient.webauthn.authenticate(\n AuthenticateRequest(\n publicKeyCredential = \"${exampleGetPublicKeyCredential}\",\n sessionDurationMinutes = 60,\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/webauthn/authenticate\nconst stytch = require('stytch');\n\nconst client = new stytch.Client({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n public_key_credential: \"${exampleGetPublicKeyCredential}\",\n session_duration_minutes: 60,\n};\n\nclient.webauthn.authenticate(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->webauthn->authenticate([\n 'public_key_credential' => '${exampleGetPublicKeyCredential}',\n 'session_duration_minutes' => 60,\n]);"
- lang: python
label: Python
source: "# POST /v1/webauthn/authenticate\nfrom stytch import Client\n\nclient = Client(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.webauthn.authenticate(\n public_key_credential=\"${exampleGetPublicKeyCredential}\",\n session_duration_minutes=60,\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# POST /v1/webauthn/authenticate\nrequire 'stytch'\n\nclient = Stytch::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.webauthn.authenticate(\n public_key_credential: \"${exampleGetPublicKeyCredential}\",\n session_duration_minutes: 60\n \n)\n\nputs resp"
- lang: rust
label: Rust
source: "// POST /v1/webauthn/authenticate\nuse stytch::consumer::client::Client;\nuse stytch::consumer::webauthn::AuthenticateRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.webauthn.authenticate(\n AuthenticateRequest{\n public_key_credential: \"${exampleGetPublicKeyCredential}\",\n session_duration_minutes: 60,\n ..Default::default()\n }\n ).await;\n println!(\"The response is {:?}\", resp);\n}"
- lang: bash
label: cURL
source: "# POST /v1/webauthn/authenticate\ncurl --request POST \\\n --url https://test.stytch.com/v1/webauthn/authenticate \\\n -u '${projectId}:${secret}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"public_key_credential\": \"${exampleGetPublicKeyCredential}\",\n \"session_duration_minutes\": 60\n }'"
/v1/webauthn/{webauthn_registration_id}:
put:
summary: Update
operationId: api_webauthn_v1_Update
tags:
- WebAuthn
description: Updates a Passkey or WebAuthn registration.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_webauthn_v1_UpdateRequest'
parameters:
- name: webauthn_registration_id
in: path
required: true
schema:
type: string
description: Globally unique UUID that identifies a Passkey or WebAuthn registration in the Stytch API. The `webauthn_registration_id` is used when you need to operate on a specific User's WebAuthn registration.
description: Globally unique UUID that identifies a Passkey or WebAuthn registration in the
# --- truncated at 32 KB (98 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/stytch/refs/heads/main/openapi/stytch-webauthn-api-openapi.yml