Authorization
This document contains details for the /api/login endpoint, including the request body, response token, and status codes.
Endpoint
POST
/api/login
Headers
Content-Type
Yes
application/json
Client-Device-Id
No
Client device identifier. When provided, the response includes deviceId.
Content-Type: application/jsonRequest body
login
string
Yes
User login or email
password
string
Yes
User password
Request example
const response = await fetch(
"https://api.docstudio.com/api/login",
{
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
login: "user@example.com",
password: "password"
})
}
);
const body = await response.text();
if (!response.ok) {
throw new Error(
`Request failed: ${response.status}\n${body}`
);
}
console.log(body);Response
token
string
Temporary authorization token. Expires after 3 hours
deviceId
string
Device ID returned only when the request includes the client device identifier header
Response example
When the request does not include the Client-Device-Id header, the response contains only the temporary authorization token. When the header is provided, the response also contains the generated deviceId.
Response without Client-Device-Id
Response with Client-Device-Id
Status codes
200
Success. The response contains a temporary authorization token and, when requested, a device ID
401
Invalid login or password
403
Authenticated user lacks required access
Related topics
Last updated
Was this helpful?
