Dashboard API > Account
Activates 2-factor authorization
Warning: Experimental API
Please note that the Dashboard API is an experimental, prerelease API. This API method is considered unstable, and should be avoided in production environments and automations. Changes may occur at any time without warning.
Body parameters
typestringRequired
Must be exactly "2fa_activation".
attributes.otp_codestringRequired
OTP code
Example:
"123456"
attributes.passwordstringRequired
Current password
Returns
Returns a resource object of type session.
Examples
PUT https://site-api.datocms.com/account/activate-2fa HTTP/1.1Authorization: Bearer YOUR-API-TOKENAccept: application/jsonX-Api-Version: 3Content-Type: application/vnd.api+json
{ "data": { "type": "2fa_activation", "attributes": { "otp_code": "123456", "password": "" } }}curl -g 'https://site-api.datocms.com/account/activate-2fa' \ -X PUT \ -H "Authorization: Bearer YOUR-API-TOKEN" \ -H "Accept: application/json" \ -H "X-Api-Version: 3" \ -H "Content-Type: application/vnd.api+json" \ --data-binary '{"data":{"type":"2fa_activation","attributes":{"otp_code":"123456","password":""}}}'await fetch("https://site-api.datocms.com/account/activate-2fa", { method: "PUT", headers: { Authorization: "Bearer YOUR-API-TOKEN", Accept: "application/json", "X-Api-Version": "3", "Content-Type": "application/vnd.api+json", }, body: JSON.stringify({ data: { type: "2fa_activation", attributes: { otp_code: "123456", password: "" }, }, }),});HTTP/1.1 200 OKContent-Type: application/jsonCache-Control: cache-control: max-age=0, private, must-revalidateX-RateLimit-Limit: 30X-RateLimit-Remaining: 28
{ "data": { "type": "session", "id": "eyJCJhbGci.eyJhaWwuY29tIn0.32wQOMci", "relationships": { "account": { "data": { "type": "account", "id": "312" } } } }, "included": [ { "type": "account", "id": "312", "attributes": { "email": "foo@bar.com", "first_name": "Mark", "last_name": "Smith", "company": "Dundler Mifflin", "is_2fa_active": true }, "relationships": { "active_subscription": { "data": null }, "billing_profile": { "data": null }, "default_organization": { "data": null } }, "meta": { "email_verified": true, "email_verification_token_sent_at": "2024-01-15T10:20:00.000Z" } } ]}