API Authentication

Only ORGANIZATION_OWNER, ORGANIZATION_ADMIN or PROJECT_ADMIN can perform configuration actions described in the Getting Started section.

Public Query Endpoints

To use Public Query Endpoints, when Query is already created, there is no authentication needed.

Obtaining Jwt Access Token

If you use API to configure Indices or Queries, or to upload Documents, you need to obtain Jwt Access token first.

Request

To do that, issue an HTTP POST request to the login endpoint:

/v1/users/login

With your email and password in the request body:

{
  "email": "[email protected]",
  "password": "my_secure_password"
}

Response

If your credentials are correct, you will receive the Jwt access token in the following format:

{
  "success": true,
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ..."
}

Access Token will expire in 1 hour. After that, a new token must be obtained.

Using Access Token

Obtained Access token needs to be attached to the Authorization header of every API request that requires authentication.

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ...

Testing Access Token

To check whether access token is working and is attached correctly, you can issue an HTTP GET request to the users/me endpoint.

/v1/users/me

If everything works correctly, you will receive information about the current user:

{
  "id": "de4e47ca-d76e-4d8a-a7f2-dea5f3787059",
  "email": "[email protected]",
  "createdAt": "2021-10-15T13:23:36.000Z",
  "updatedAt": "2021-10-15T13:23:36.000Z",
  "organizations": [
    {
      "id": "a0721954-1964-41d1-9135-8459f0b06b2c",
      "name": "Your Organization",
      "slug": "your-organization",
      "createdAt": "2021-10-28T12:32:19.000Z",
      "updatedAt": "2021-10-28T12:32:19.000Z",
      "role": "ORGANIZATION_ADMIN"
    }
  ]
}