---
title: "Login with Basic Authentication"
method: POST
path: "/token"
tags: ["Session Management"]
---

# Login with Basic Authentication

`POST /token`

## Request

- Base URL: `https://dataops.nexla.io/nexla-api`
- URL: `https://dataops.nexla.io/nexla-api/token`
- Auth: HTTP basic
- TypeScript: <https://skmtc.dev/nexla/apis/nexla-rest-api/docs/token/post.ts> (a function with typed inputs; its response is checked against the schema)

Use this endpoint for authentication if your organization allows basic authentication. A successful authentication attempt will result in an `access_token` that can be used to make authenticated requests to other API endpoints. The `access_token` automatically expires after a fixed duration, but you can also call the `/logout` endpoint to invalidate the access token at the end of your session.

Nexla supports various methods of authentication, including Basic (email/password), Google SSO, and custom SAML- or OIDC-based SSO. One or more of these methods might be allowed in any organization, depending on the configuration chosen by the administrators. Instead of using this endpoint to start a session programmatically, we recommend performing authentication through the Nexla UI and using the Nexla Session Token (available in Tools >> Nexla Session Token) to connect to the API programmatically.

> Note: A user might belong to multiple organizations. This method initiates an authenticated session in their default organization.

## Response `200`

Success

- Token
  - `access_token` string
  - `token_type` 'Bearer'
  - `expires_in` integer
  - `user` UserBrief
    - `id` integer
    - `full_name` string
    - `email` string
    - `org` integer
    - `impersonated` boolean
    - `impersonator` object
      - `id` integer
      - `full_name` string
      - `email` string
      - `email_verified_at` string, date-time
      - `org` integer
  - `org_membership` OrgMembershipToken
    - `api_key` string
    - `status` 'ACTIVE' | 'DEACTIVATED': Indicates whether the user's membership in this organization is active or not. If the membership is DEACTIVATED the user can no longer access the account but the resources owned by them will still be accessible by the organization administrators.
    - `is_admin?` boolean
  - `org` OrgSimplified
    - `id` integer
    - `name` string
    - `email_domain` string
    - `email` string
    - `client_identifier` string
    - `org_webhook_host` string

## Other responses

- `401`: Unauthorized

---

[API](https://skmtc.dev/nexla/apis/nexla-rest-api.md) - [All operations](https://skmtc.dev/nexla/apis/nexla-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/nexla/apis/nexla-rest-api/revisions/ef02be92fe7b?raw)
