@ory/kratos-client
Version:
OpenAPI client for @ory/kratos-client
827 lines (573 loc) • 115 kB
Markdown
# FrontendApi
All URIs are relative to *http://localhost*
|Method | HTTP request | Description|
|------------- | ------------- | -------------|
|[**createBrowserLoginFlow**](#createbrowserloginflow) | **GET** /self-service/login/browser | Create Login Flow for Browsers|
|[**createBrowserLogoutFlow**](#createbrowserlogoutflow) | **GET** /self-service/logout/browser | Create a Logout URL for Browsers|
|[**createBrowserRecoveryFlow**](#createbrowserrecoveryflow) | **GET** /self-service/recovery/browser | Create Recovery Flow for Browsers|
|[**createBrowserRegistrationFlow**](#createbrowserregistrationflow) | **GET** /self-service/registration/browser | Create Registration Flow for Browsers|
|[**createBrowserSettingsFlow**](#createbrowsersettingsflow) | **GET** /self-service/settings/browser | Create Settings Flow for Browsers|
|[**createBrowserVerificationFlow**](#createbrowserverificationflow) | **GET** /self-service/verification/browser | Create Verification Flow for Browser Clients|
|[**createFedcmFlow**](#createfedcmflow) | **GET** /self-service/fed-cm/parameters | Get FedCM Parameters|
|[**createNativeLoginFlow**](#createnativeloginflow) | **GET** /self-service/login/api | Create Login Flow for Native Apps|
|[**createNativeRecoveryFlow**](#createnativerecoveryflow) | **GET** /self-service/recovery/api | Create Recovery Flow for Native Apps|
|[**createNativeRegistrationFlow**](#createnativeregistrationflow) | **GET** /self-service/registration/api | Create Registration Flow for Native Apps|
|[**createNativeSettingsFlow**](#createnativesettingsflow) | **GET** /self-service/settings/api | Create Settings Flow for Native Apps|
|[**createNativeVerificationFlow**](#createnativeverificationflow) | **GET** /self-service/verification/api | Create Verification Flow for Native Apps|
|[**disableMyOtherSessions**](#disablemyothersessions) | **DELETE** /sessions | Disable my other sessions|
|[**disableMySession**](#disablemysession) | **DELETE** /sessions/{id} | Disable one of my sessions|
|[**exchangeSessionToken**](#exchangesessiontoken) | **GET** /sessions/token-exchange | Exchange Session Token|
|[**getFlowError**](#getflowerror) | **GET** /self-service/errors | Get User-Flow Errors|
|[**getLoginFlow**](#getloginflow) | **GET** /self-service/login/flows | Get Login Flow|
|[**getRecoveryFlow**](#getrecoveryflow) | **GET** /self-service/recovery/flows | Get Recovery Flow|
|[**getRegistrationFlow**](#getregistrationflow) | **GET** /self-service/registration/flows | Get Registration Flow|
|[**getSettingsFlow**](#getsettingsflow) | **GET** /self-service/settings/flows | Get Settings Flow|
|[**getVerificationFlow**](#getverificationflow) | **GET** /self-service/verification/flows | Get Verification Flow|
|[**getWebAuthnJavaScript**](#getwebauthnjavascript) | **GET** /.well-known/ory/webauthn.js | Get WebAuthn JavaScript|
|[**listMySessions**](#listmysessions) | **GET** /sessions | Get My Active Sessions|
|[**performNativeLogout**](#performnativelogout) | **DELETE** /self-service/logout/api | Perform Logout for Native Apps|
|[**toSession**](#tosession) | **GET** /sessions/whoami | Check Who the Current HTTP Session Belongs To|
|[**updateFedcmFlow**](#updatefedcmflow) | **POST** /self-service/fed-cm/token | Submit a FedCM token|
|[**updateLoginFlow**](#updateloginflow) | **POST** /self-service/login | Submit a Login Flow|
|[**updateLogoutFlow**](#updatelogoutflow) | **GET** /self-service/logout | Update Logout Flow|
|[**updateRecoveryFlow**](#updaterecoveryflow) | **POST** /self-service/recovery | Update Recovery Flow|
|[**updateRegistrationFlow**](#updateregistrationflow) | **POST** /self-service/registration | Update Registration Flow|
|[**updateSettingsFlow**](#updatesettingsflow) | **POST** /self-service/settings | Complete Settings Flow|
|[**updateVerificationFlow**](#updateverificationflow) | **POST** /self-service/verification | Complete Verification Flow|
# **createBrowserLoginFlow**
> LoginFlow createBrowserLoginFlow()
This endpoint initializes a browser-based user login flow. This endpoint will set the appropriate cookies and anti-CSRF measures required for browser-based flows. If this endpoint is opened as a link in the browser, it will be redirected to `selfservice.flows.login.ui_url` with the flow ID set as the query parameter `?flow=`. If a valid user session exists already, the browser will be redirected to `urls.default_redirect_url` unless the query parameter `?refresh=true` was set. If this endpoint is called via an AJAX request, the response contains the flow without a redirect. In the case of an error, the `error.id` of the JSON response body can be one of: `session_already_available`: The user is already signed in. `session_aal1_required`: Multi-factor auth (e.g. 2fa) was requested but the user has no session yet. `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. `security_identity_mismatch`: The requested `?return_to` address is not allowed to be used. Adjust this in the configuration! The optional query parameter login_challenge is set when using Kratos with Hydra in an OAuth2 flow. See the oauth2_provider.url configuration option. This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration).
### Example
```typescript
import {
FrontendApi,
Configuration
} from '@ory/kratos-client';
const configuration = new Configuration();
const apiInstance = new FrontendApi(configuration);
let refresh: boolean; //Refresh a login session If set to true, this will refresh an existing login session by asking the user to sign in again. This will reset the authenticated_at time of the session. (optional) (default to undefined)
let aal: string; //Request a Specific AuthenticationMethod Assurance Level Use this parameter to upgrade an existing session\'s authenticator assurance level (AAL). This allows you to ask for multi-factor authentication. When an identity sign in using e.g. username+password, the AAL is 1. If you wish to \"upgrade\" the session\'s security by asking the user to perform TOTP / WebAuth/ ... you would set this to \"aal2\". (optional) (default to undefined)
let returnTo: string; //The URL to return the browser to after the flow was completed. (optional) (default to undefined)
let cookie: string; //HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. (optional) (default to undefined)
let loginChallenge: string; //An optional Hydra login challenge. If present, Kratos will cooperate with Ory Hydra to act as an OAuth2 identity provider. The value for this parameter comes from `login_challenge` URL Query parameter sent to your application (e.g. `/login?login_challenge=abcde`). (optional) (default to undefined)
let organization: string; //An optional organization ID that should be used for logging this user in. This parameter is only effective in the Ory Network. (optional) (default to undefined)
let via: string; //Via should contain the identity\'s credential the code should be sent to. Only relevant in aal2 flows. DEPRECATED: This field is deprecated. Please remove it from your requests. The user will now see a choice of MFA credentials to choose from to perform the second factor instead. (optional) (default to undefined)
let identitySchema: string; //An optional identity schema to use for the login flow. (optional) (default to undefined)
const { status, data } = await apiInstance.createBrowserLoginFlow(
refresh,
aal,
returnTo,
cookie,
loginChallenge,
organization,
via,
identitySchema
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **refresh** | [**boolean**] | Refresh a login session If set to true, this will refresh an existing login session by asking the user to sign in again. This will reset the authenticated_at time of the session. | (optional) defaults to undefined|
| **aal** | [**string**] | Request a Specific AuthenticationMethod Assurance Level Use this parameter to upgrade an existing session\'s authenticator assurance level (AAL). This allows you to ask for multi-factor authentication. When an identity sign in using e.g. username+password, the AAL is 1. If you wish to \"upgrade\" the session\'s security by asking the user to perform TOTP / WebAuth/ ... you would set this to \"aal2\". | (optional) defaults to undefined|
| **returnTo** | [**string**] | The URL to return the browser to after the flow was completed. | (optional) defaults to undefined|
| **cookie** | [**string**] | HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. | (optional) defaults to undefined|
| **loginChallenge** | [**string**] | An optional Hydra login challenge. If present, Kratos will cooperate with Ory Hydra to act as an OAuth2 identity provider. The value for this parameter comes from `login_challenge` URL Query parameter sent to your application (e.g. `/login?login_challenge=abcde`). | (optional) defaults to undefined|
| **organization** | [**string**] | An optional organization ID that should be used for logging this user in. This parameter is only effective in the Ory Network. | (optional) defaults to undefined|
| **via** | [**string**] | Via should contain the identity\'s credential the code should be sent to. Only relevant in aal2 flows. DEPRECATED: This field is deprecated. Please remove it from your requests. The user will now see a choice of MFA credentials to choose from to perform the second factor instead. | (optional) defaults to undefined|
| **identitySchema** | [**string**] | An optional identity schema to use for the login flow. | (optional) defaults to undefined|
### Return type
**LoginFlow**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | loginFlow | - |
|**303** | Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 204. | - |
|**400** | errorGeneric | - |
|**0** | errorGeneric | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **createBrowserLogoutFlow**
> LogoutFlow createBrowserLogoutFlow()
This endpoint initializes a browser-based user logout flow and a URL which can be used to log out the user. This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). For API clients you can call the `/self-service/logout/api` URL directly with the Ory Session Token. The URL is only valid for the currently signed in user. If no user is signed in, this endpoint returns a 401 error. When calling this endpoint from a backend, please ensure to properly forward the HTTP cookies.
### Example
```typescript
import {
FrontendApi,
Configuration
} from '@ory/kratos-client';
const configuration = new Configuration();
const apiInstance = new FrontendApi(configuration);
let cookie: string; //HTTP Cookies If you call this endpoint from a backend, please include the original Cookie header in the request. (optional) (default to undefined)
let returnTo: string; //Return to URL The URL to which the browser should be redirected to after the logout has been performed. (optional) (default to undefined)
const { status, data } = await apiInstance.createBrowserLogoutFlow(
cookie,
returnTo
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **cookie** | [**string**] | HTTP Cookies If you call this endpoint from a backend, please include the original Cookie header in the request. | (optional) defaults to undefined|
| **returnTo** | [**string**] | Return to URL The URL to which the browser should be redirected to after the logout has been performed. | (optional) defaults to undefined|
### Return type
**LogoutFlow**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | logoutFlow | - |
|**400** | errorGeneric | - |
|**401** | errorGeneric | - |
|**500** | errorGeneric | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **createBrowserRecoveryFlow**
> RecoveryFlow createBrowserRecoveryFlow()
This endpoint initializes a browser-based account recovery flow. Once initialized, the browser will be redirected to `selfservice.flows.recovery.ui_url` with the flow ID set as the query parameter `?flow=`. If a valid user session exists, the browser is returned to the configured return URL. If this endpoint is called via an AJAX request, the response contains the recovery flow without any redirects or a 400 bad request error if the user is already authenticated. This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery).
### Example
```typescript
import {
FrontendApi,
Configuration
} from '@ory/kratos-client';
const configuration = new Configuration();
const apiInstance = new FrontendApi(configuration);
let returnTo: string; //The URL to return the browser to after the flow was completed. (optional) (default to undefined)
const { status, data } = await apiInstance.createBrowserRecoveryFlow(
returnTo
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **returnTo** | [**string**] | The URL to return the browser to after the flow was completed. | (optional) defaults to undefined|
### Return type
**RecoveryFlow**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | recoveryFlow | - |
|**303** | Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 204. | - |
|**400** | errorGeneric | - |
|**0** | errorGeneric | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **createBrowserRegistrationFlow**
> RegistrationFlow createBrowserRegistrationFlow()
This endpoint initializes a browser-based user registration flow. This endpoint will set the appropriate cookies and anti-CSRF measures required for browser-based flows. If this endpoint is opened as a link in the browser, it will be redirected to `selfservice.flows.registration.ui_url` with the flow ID set as the query parameter `?flow=`. If a valid user session exists already, the browser will be redirected to `urls.default_redirect_url`. If this endpoint is called via an AJAX request, the response contains the flow without a redirect. In the case of an error, the `error.id` of the JSON response body can be one of: `session_already_available`: The user is already signed in. `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. `security_identity_mismatch`: The requested `?return_to` address is not allowed to be used. Adjust this in the configuration! If this endpoint is called via an AJAX request, the response contains the registration flow without a redirect. This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration).
### Example
```typescript
import {
FrontendApi,
Configuration
} from '@ory/kratos-client';
const configuration = new Configuration();
const apiInstance = new FrontendApi(configuration);
let returnTo: string; //The URL to return the browser to after the flow was completed. (optional) (default to undefined)
let loginChallenge: string; //Ory OAuth 2.0 Login Challenge. If set will cooperate with Ory OAuth2 and OpenID to act as an OAuth2 server / OpenID Provider. The value for this parameter comes from `login_challenge` URL Query parameter sent to your application (e.g. `/registration?login_challenge=abcde`). This feature is compatible with Ory Hydra when not running on the Ory Network. (optional) (default to undefined)
let afterVerificationReturnTo: string; //The URL to return the browser to after the verification flow was completed. After the registration flow is completed, the user will be sent a verification email. Upon completing the verification flow, this URL will be used to override the default `selfservice.flows.verification.after.default_redirect_to` value. (optional) (default to undefined)
let organization: string; //An optional organization ID that should be used to register this user. This parameter is only effective in the Ory Network. (optional) (default to undefined)
let identitySchema: string; //An optional identity schema to use for the registration flow. (optional) (default to undefined)
const { status, data } = await apiInstance.createBrowserRegistrationFlow(
returnTo,
loginChallenge,
afterVerificationReturnTo,
organization,
identitySchema
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **returnTo** | [**string**] | The URL to return the browser to after the flow was completed. | (optional) defaults to undefined|
| **loginChallenge** | [**string**] | Ory OAuth 2.0 Login Challenge. If set will cooperate with Ory OAuth2 and OpenID to act as an OAuth2 server / OpenID Provider. The value for this parameter comes from `login_challenge` URL Query parameter sent to your application (e.g. `/registration?login_challenge=abcde`). This feature is compatible with Ory Hydra when not running on the Ory Network. | (optional) defaults to undefined|
| **afterVerificationReturnTo** | [**string**] | The URL to return the browser to after the verification flow was completed. After the registration flow is completed, the user will be sent a verification email. Upon completing the verification flow, this URL will be used to override the default `selfservice.flows.verification.after.default_redirect_to` value. | (optional) defaults to undefined|
| **organization** | [**string**] | An optional organization ID that should be used to register this user. This parameter is only effective in the Ory Network. | (optional) defaults to undefined|
| **identitySchema** | [**string**] | An optional identity schema to use for the registration flow. | (optional) defaults to undefined|
### Return type
**RegistrationFlow**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | registrationFlow | - |
|**303** | Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 204. | - |
|**0** | errorGeneric | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **createBrowserSettingsFlow**
> SettingsFlow createBrowserSettingsFlow()
This endpoint initializes a browser-based user settings flow. Once initialized, the browser will be redirected to `selfservice.flows.settings.ui_url` with the flow ID set as the query parameter `?flow=`. If no valid Ory Kratos Session Cookie is included in the request, a login flow will be initialized. If this endpoint is opened as a link in the browser, it will be redirected to `selfservice.flows.settings.ui_url` with the flow ID set as the query parameter `?flow=`. If no valid user session was set, the browser will be redirected to the login endpoint. If this endpoint is called via an AJAX request, the response contains the settings flow without any redirects or a 401 forbidden error if no valid session was set. Depending on your configuration this endpoint might return a 403 error if the session has a lower Authenticator Assurance Level (AAL) than is possible for the identity. This can happen if the identity has password + webauthn credentials (which would result in AAL2) but the session has only AAL1. If this error occurs, ask the user to sign in with the second factor (happens automatically for server-side browser flows) or change the configuration. If this endpoint is called via an AJAX request, the response contains the flow without a redirect. In the case of an error, the `error.id` of the JSON response body can be one of: `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. `session_inactive`: No Ory Session was found - sign in a user first. `security_identity_mismatch`: The requested `?return_to` address is not allowed to be used. Adjust this in the configuration! This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings).
### Example
```typescript
import {
FrontendApi,
Configuration
} from '@ory/kratos-client';
const configuration = new Configuration();
const apiInstance = new FrontendApi(configuration);
let returnTo: string; //The URL to return the browser to after the flow was completed. (optional) (default to undefined)
let cookie: string; //HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. (optional) (default to undefined)
const { status, data } = await apiInstance.createBrowserSettingsFlow(
returnTo,
cookie
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **returnTo** | [**string**] | The URL to return the browser to after the flow was completed. | (optional) defaults to undefined|
| **cookie** | [**string**] | HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. | (optional) defaults to undefined|
### Return type
**SettingsFlow**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | settingsFlow | - |
|**303** | Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 204. | - |
|**400** | errorGeneric | - |
|**401** | errorGeneric | - |
|**403** | errorGeneric | - |
|**0** | errorGeneric | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **createBrowserVerificationFlow**
> VerificationFlow createBrowserVerificationFlow()
This endpoint initializes a browser-based account verification flow. Once initialized, the browser will be redirected to `selfservice.flows.verification.ui_url` with the flow ID set as the query parameter `?flow=`. If this endpoint is called via an AJAX request, the response contains the recovery flow without any redirects. This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation).
### Example
```typescript
import {
FrontendApi,
Configuration
} from '@ory/kratos-client';
const configuration = new Configuration();
const apiInstance = new FrontendApi(configuration);
let returnTo: string; //The URL to return the browser to after the flow was completed. (optional) (default to undefined)
const { status, data } = await apiInstance.createBrowserVerificationFlow(
returnTo
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **returnTo** | [**string**] | The URL to return the browser to after the flow was completed. | (optional) defaults to undefined|
### Return type
**VerificationFlow**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | verificationFlow | - |
|**303** | Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 204. | - |
|**0** | errorGeneric | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **createFedcmFlow**
> CreateFedcmFlowResponse createFedcmFlow()
This endpoint returns a list of all available FedCM providers. It is only supported on the Ory Network.
### Example
```typescript
import {
FrontendApi,
Configuration
} from '@ory/kratos-client';
const configuration = new Configuration();
const apiInstance = new FrontendApi(configuration);
const { status, data } = await apiInstance.createFedcmFlow();
```
### Parameters
This endpoint does not have any parameters.
### Return type
**CreateFedcmFlowResponse**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | createFedcmFlowResponse | - |
|**400** | errorGeneric | - |
|**0** | errorGeneric | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **createNativeLoginFlow**
> LoginFlow createNativeLoginFlow()
This endpoint initiates a login flow for native apps that do not use a browser, such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error will be returned unless the URL query parameter `?refresh=true` is set. To fetch an existing login flow call `/self-service/login/flows?flow=<flow_id>`. You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks, including CSRF login attacks. In the case of an error, the `error.id` of the JSON response body can be one of: `session_already_available`: The user is already signed in. `session_aal1_required`: Multi-factor auth (e.g. 2fa) was requested but the user has no session yet. `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration).
### Example
```typescript
import {
FrontendApi,
Configuration
} from '@ory/kratos-client';
const configuration = new Configuration();
const apiInstance = new FrontendApi(configuration);
let refresh: boolean; //Refresh a login session If set to true, this will refresh an existing login session by asking the user to sign in again. This will reset the authenticated_at time of the session. (optional) (default to undefined)
let aal: string; //Request a Specific AuthenticationMethod Assurance Level Use this parameter to upgrade an existing session\'s authenticator assurance level (AAL). This allows you to ask for multi-factor authentication. When an identity sign in using e.g. username+password, the AAL is 1. If you wish to \"upgrade\" the session\'s security by asking the user to perform TOTP / WebAuth/ ... you would set this to \"aal2\". (optional) (default to undefined)
let xSessionToken: string; //The Session Token of the Identity performing the settings flow. (optional) (default to undefined)
let returnSessionTokenExchangeCode: boolean; //EnableSessionTokenExchangeCode requests the login flow to include a code that can be used to retrieve the session token after the login flow has been completed. (optional) (default to undefined)
let returnTo: string; //The URL to return the browser to after the flow was completed. (optional) (default to undefined)
let organization: string; //An optional organization ID that should be used for logging this user in. This parameter is only effective in the Ory Network. (optional) (default to undefined)
let via: string; //Via should contain the identity\'s credential the code should be sent to. Only relevant in aal2 flows. DEPRECATED: This field is deprecated. Please remove it from your requests. The user will now see a choice of MFA credentials to choose from to perform the second factor instead. (optional) (default to undefined)
let identitySchema: string; //An optional identity schema to use for the login flow. (optional) (default to undefined)
const { status, data } = await apiInstance.createNativeLoginFlow(
refresh,
aal,
xSessionToken,
returnSessionTokenExchangeCode,
returnTo,
organization,
via,
identitySchema
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **refresh** | [**boolean**] | Refresh a login session If set to true, this will refresh an existing login session by asking the user to sign in again. This will reset the authenticated_at time of the session. | (optional) defaults to undefined|
| **aal** | [**string**] | Request a Specific AuthenticationMethod Assurance Level Use this parameter to upgrade an existing session\'s authenticator assurance level (AAL). This allows you to ask for multi-factor authentication. When an identity sign in using e.g. username+password, the AAL is 1. If you wish to \"upgrade\" the session\'s security by asking the user to perform TOTP / WebAuth/ ... you would set this to \"aal2\". | (optional) defaults to undefined|
| **xSessionToken** | [**string**] | The Session Token of the Identity performing the settings flow. | (optional) defaults to undefined|
| **returnSessionTokenExchangeCode** | [**boolean**] | EnableSessionTokenExchangeCode requests the login flow to include a code that can be used to retrieve the session token after the login flow has been completed. | (optional) defaults to undefined|
| **returnTo** | [**string**] | The URL to return the browser to after the flow was completed. | (optional) defaults to undefined|
| **organization** | [**string**] | An optional organization ID that should be used for logging this user in. This parameter is only effective in the Ory Network. | (optional) defaults to undefined|
| **via** | [**string**] | Via should contain the identity\'s credential the code should be sent to. Only relevant in aal2 flows. DEPRECATED: This field is deprecated. Please remove it from your requests. The user will now see a choice of MFA credentials to choose from to perform the second factor instead. | (optional) defaults to undefined|
| **identitySchema** | [**string**] | An optional identity schema to use for the login flow. | (optional) defaults to undefined|
### Return type
**LoginFlow**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | loginFlow | - |
|**400** | errorGeneric | - |
|**0** | errorGeneric | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **createNativeRecoveryFlow**
> RecoveryFlow createNativeRecoveryFlow()
This endpoint initiates a recovery flow for API clients such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error. On an existing recovery flow, use the `getRecoveryFlow` API endpoint. You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery).
### Example
```typescript
import {
FrontendApi,
Configuration
} from '@ory/kratos-client';
const configuration = new Configuration();
const apiInstance = new FrontendApi(configuration);
const { status, data } = await apiInstance.createNativeRecoveryFlow();
```
### Parameters
This endpoint does not have any parameters.
### Return type
**RecoveryFlow**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | recoveryFlow | - |
|**400** | errorGeneric | - |
|**0** | errorGeneric | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **createNativeRegistrationFlow**
> RegistrationFlow createNativeRegistrationFlow()
This endpoint initiates a registration flow for API clients such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error will be returned unless the URL query parameter `?refresh=true` is set. To fetch an existing registration flow call `/self-service/registration/flows?flow=<flow_id>`. You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks. In the case of an error, the `error.id` of the JSON response body can be one of: `session_already_available`: The user is already signed in. `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration).
### Example
```typescript
import {
FrontendApi,
Configuration
} from '@ory/kratos-client';
const configuration = new Configuration();
const apiInstance = new FrontendApi(configuration);
let returnSessionTokenExchangeCode: boolean; //EnableSessionTokenExchangeCode requests the login flow to include a code that can be used to retrieve the session token after the login flow has been completed. (optional) (default to undefined)
let returnTo: string; //The URL to return the browser to after the flow was completed. (optional) (default to undefined)
let organization: string; //An optional organization ID that should be used to register this user. This parameter is only effective in the Ory Network. (optional) (default to undefined)
let identitySchema: string; //An optional identity schema to use for the registration flow. (optional) (default to undefined)
const { status, data } = await apiInstance.createNativeRegistrationFlow(
returnSessionTokenExchangeCode,
returnTo,
organization,
identitySchema
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **returnSessionTokenExchangeCode** | [**boolean**] | EnableSessionTokenExchangeCode requests the login flow to include a code that can be used to retrieve the session token after the login flow has been completed. | (optional) defaults to undefined|
| **returnTo** | [**string**] | The URL to return the browser to after the flow was completed. | (optional) defaults to undefined|
| **organization** | [**string**] | An optional organization ID that should be used to register this user. This parameter is only effective in the Ory Network. | (optional) defaults to undefined|
| **identitySchema** | [**string**] | An optional identity schema to use for the registration flow. | (optional) defaults to undefined|
### Return type
**RegistrationFlow**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | registrationFlow | - |
|**400** | errorGeneric | - |
|**0** | errorGeneric | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **createNativeSettingsFlow**
> SettingsFlow createNativeSettingsFlow()
This endpoint initiates a settings flow for API clients such as mobile devices, smart TVs, and so on. You must provide a valid Ory Kratos Session Token for this endpoint to respond with HTTP 200 OK. To fetch an existing settings flow call `/self-service/settings/flows?flow=<flow_id>`. You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks. Depending on your configuration this endpoint might return a 403 error if the session has a lower Authenticator Assurance Level (AAL) than is possible for the identity. This can happen if the identity has password + webauthn credentials (which would result in AAL2) but the session has only AAL1. If this error occurs, ask the user to sign in with the second factor or change the configuration. In the case of an error, the `error.id` of the JSON response body can be one of: `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. `session_inactive`: No Ory Session was found - sign in a user first. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings).
### Example
```typescript
import {
FrontendApi,
Configuration
} from '@ory/kratos-client';
const configuration = new Configuration();
const apiInstance = new FrontendApi(configuration);
let xSessionToken: string; //The Session Token of the Identity performing the settings flow. (optional) (default to undefined)
const { status, data } = await apiInstance.createNativeSettingsFlow(
xSessionToken
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **xSessionToken** | [**string**] | The Session Token of the Identity performing the settings flow. | (optional) defaults to undefined|
### Return type
**SettingsFlow**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | settingsFlow | - |
|**400** | errorGeneric | - |
|**0** | errorGeneric | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **createNativeVerificationFlow**
> VerificationFlow createNativeVerificationFlow()
This endpoint initiates a verification flow for API clients such as mobile devices, smart TVs, and so on. To fetch an existing verification flow call `/self-service/verification/flows?flow=<flow_id>`. You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation).
### Example
```typescript
import {
FrontendApi,
Configuration
} from '@ory/kratos-client';
const configuration = new Configuration();
const apiInstance = new FrontendApi(configuration);
let returnTo: string; //A URL contained in the return_to key of the verification flow. This piece of data has no effect on the actual logic of the flow and is purely informational. (optional) (default to undefined)
const { status, data } = await apiInstance.createNativeVerificationFlow(
returnTo
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **returnTo** | [**string**] | A URL contained in the return_to key of the verification flow. This piece of data has no effect on the actual logic of the flow and is purely informational. | (optional) defaults to undefined|
### Return type
**VerificationFlow**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | verificationFlow | - |
|**400** | errorGeneric | - |
|**0** | errorGeneric | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **disableMyOtherSessions**
> DeleteMySessionsCount disableMyOtherSessions()
Calling this endpoint invalidates all except the current session that belong to the logged-in user. Session data are not deleted.
### Example
```typescript
import {
FrontendApi,
Configuration
} from '@ory/kratos-client';
const configuration = new Configuration();
const apiInstance = new FrontendApi(configuration);
let xSessionToken: string; //Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. (optional) (default to undefined)
let cookie: string; //Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored. (optional) (default to undefined)
const { status, data } = await apiInstance.disableMyOtherSessions(
xSessionToken,
cookie
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **xSessionToken** | [**string**] | Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. | (optional) defaults to undefined|
| **cookie** | [**string**] | Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored. | (optional) defaults to undefined|
### Return type
**DeleteMySessionsCount**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
|**200** | deleteMySessionsCount | - |
|**400** | errorGeneric | - |
|**401** | errorGeneric | - |
|**0** | errorGeneric | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **disableMySession**
> disableMySession()
Calling this endpoint invalidates the specified session. The current session cannot be revoked. Session data are not deleted.
### Example
```typescript
import {
FrontendApi,
Configuration
} from '@ory/kratos-client';
const configuration = new Configuration();
const apiInstance = new FrontendApi(configuration);
let id: string; //ID is the session\'s ID. (default to undefined)
let xSessionToken: string; //Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. (optional) (default to undefined)
let cookie: string; //Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored. (optional) (default to undefined)
const { status, data } = await apiInstance.disableMySession(
id,
xSessionToken,
cookie
);
```
### Parameters
|Name | Type | Description | Notes|
|------------- | ------------- | ------------- | -------------|
| **id** | [**string**] | ID is the session\'s ID. | defaults to undefined|
| **xSessionToken** | [**string**] | Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. | (optional) defaults to undefined|
| **cookie** | [**string**] | Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f&