Show examples in:
JavascriptHTTP
Endpoint info
Available examples
Dashboard API > Account

Confirm email change

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.

Confirms a pending email change using the token sent to the new email address. If the caller is authenticated as the same account, returns a new session (200). Otherwise returns 204 No Content.

Body parameters

typestringRequired

Must be exactly "email_change_confirmation".

attributes.tokenstringRequired

Email confirmation token

attributes.account_idstringRequired

Account ID

Returns

Returns a resource object of type session.

Examples

POST https://site-api.datocms.com/account/confirm-email-change HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Content-Type: application/vnd.api+json
{
"data": {
"type": "email_change_confirmation",
"attributes": {
"token": "",
"account_id": ""
}
}
}
Terminal window
curl -g 'https://site-api.datocms.com/account/confirm-email-change' \
-X POST \
-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":"email_change_confirmation","attributes":{"token":"","account_id":""}}}'
await fetch("https://site-api.datocms.com/account/confirm-email-change", {
method: "POST",
headers: {
Authorization: "Bearer YOUR-API-TOKEN",
Accept: "application/json",
"X-Api-Version": "3",
"Content-Type": "application/vnd.api+json",
},
body: JSON.stringify({
data: {
type: "email_change_confirmation",
attributes: { token: "", account_id: "" },
},
}),
});
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: cache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit: 30
X-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"
}
}
]
}