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

Update a account

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 "account".

attributes.emailstringOptional

Email

Example:"foo@bar.com"
attributes.first_namestring, nullOptional

First name

Example:"Mark"
attributes.last_namestring, nullOptional

Last name

Example:"Smith"
attributes.companystring, nullOptional

Company name

Example:"Dundler Mifflin"
attributes.passwordstringOptional

New password

attributes.current_passwordstringOptional

Current password (required if new_password or email is set)

attributes.otp_codestringOptional

Two-factor authentication one-time password (required if new_password or email is set)

Example:"123512"
relationships.default_organization.dataOptional
Type:null, <a href="/docs/content-management-api/resources/organization">ResourceLinkage&#x3C;"organization"></a>

Returns

Returns a resource object of type session.

Examples

PUT https://site-api.datocms.com/account HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Content-Type: application/vnd.api+json
{
"data": {
"type": "account",
"id": "312"
}
}
Terminal window
curl -g 'https://site-api.datocms.com/account' \
-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":"account","id":"312"}}'
await fetch("https://site-api.datocms.com/account", {
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: "account", id: "312" } }),
});
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"
}
}
]
}