Sorry, no results found for "".
Must be exactly "email_credentials".
"email_credentials"
Email
"foo@bar.com"
Password
"changeme"
Two-factor authentication one-time password
"123512"
Returns a resource object of type session.
1POST https://site-api.datocms.com/sessions HTTP/1.12Authorization: Bearer YOUR-API-TOKEN3Accept: application/json4X-Api-Version: 35Content-Type: application/vnd.api+json6 7{8 "data": {9 "type": "email_credentials",10 "attributes": {11 "email": "foo@bar.com",12 "password": "changeme"13 }14 }15}
1curl -g 'https://site-api.datocms.com/sessions' \2 -X POST \3 -H "Authorization: Bearer YOUR-API-TOKEN" \4 -H "Accept: application/json" \5 -H "X-Api-Version: 3" \6 -H "Content-Type: application/vnd.api+json" \7 --data-binary '{"data":{"type":"email_credentials","attributes":{"email":"foo@bar.com","password":"changeme"}}}'
1await fetch("https://site-api.datocms.com/sessions", {2 method: "POST",3 headers: {4 Authorization: "Bearer YOUR-API-TOKEN",5 Accept: "application/json",6 "X-Api-Version": "3",7 "Content-Type": "application/vnd.api+json",8 },9 body: JSON.stringify({10 data: {11 type: "email_credentials",12 attributes: { email: "foo@bar.com", password: "changeme" },13 },14 }),15});
1HTTP/1.1 200 OK2Content-Type: application/json3Cache-Control: cache-control: max-age=0, private, must-revalidate4X-RateLimit-Limit: 305X-RateLimit-Remaining: 286 7{8 "data": {9 "type": "session",10 "id": "eyJCJhbGci.eyJhaWwuY29tIn0.32wQOMci",11 "relationships": {12 "user": {13 "data": {14 "type": "user",15 "id": "312"16 }17 }18 }19 },20 "included": [21 {22 "type": "user",23 "id": "312",24 "relationships": {25 "role": {26 "data": {27 "type": "role",28 "id": "34"29 }30 }31 },32 "attributes": {33 "email": "mark.smith@example.com",34 "is_2fa_active": true,35 "full_name": "Mark Smith",36 "is_active": true37 }38 }39 ]40}