For the complete documentation index, see llms.txt. This page is also available as Markdown.

Authorization

This document contains details for the /api/login endpoint, including the request body, response token, and status codes.

Endpoint

Method
Endpoint

POST

/api/login

Headers

Header
Required
Description

Content-Type

Yes

application/json

Client-Device-Id

No

Client device identifier. When provided, the response includes deviceId.

Content-Type: application/json

Request body

Field
Type
Required
Description

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

The response always contains a temporary authorization token. The deviceId field is returned only when the request includes the client device ID header; otherwise, this field is omitted.

Field
Type
Description

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

Code
Description

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

Last updated

Was this helpful?