> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ocient.com/llms.txt
> Use this file to discover all available pages before exploring further.

# login

> Authenticates a user with a username and password and then returns a token for use in subsequent API calls. This request also sets a session cookie. 

Include the returned access token in the authorization header for subsequent requests in the format: 
Authorization: Bearer {token}.



## OpenAPI

````yaml /openapi/generated-api-methods.json POST /v1/login
openapi: 3.1.0
info:
  title: Generated API methods
  version: 1.0.0
  description: Generated from imported ApiMethodV2 blocks.
servers:
  - url: https://{sql_node}
    variables:
      sql_node:
        default: sql_node
  - url: http://oc1-lts0:9090
security: []
paths:
  /v1/login:
    post:
      tags:
        - Ocient HTTP Query API
      summary: login
      description: >-
        Authenticates a user with a username and password and then returns a
        token for use in subsequent API calls. This request also sets a session
        cookie. 


        Include the returned access token in the authorization header for
        subsequent requests in the format: 

        Authorization: Bearer {token}.
      operationId: postOcientHttpQueryApiLogin
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                username:
                  type: string
                  description: Username.
                password:
                  type: string
                  description: The password for the username.
                database:
                  type: string
                  description: >-
                    Target database name. If you do not specify this parameter,
                    the request defaults this value to system.
              required:
                - username
                - password
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  access_token:
                    type: string
                  username:
                    type: string
                  database:
                    type: string
                  expires_in:
                    type: integer
                  status:
                    type: object
                    properties:
                      reason:
                        type: string
                      sql_state:
                        type: string
                      vendor_code:
                        type: integer
              examples:
                response:
                  value:
                    access_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
                    username: jdoe
                    database: retail_analytics
                    expires_in: 3600
                    status:
                      reason: Authentication successful
                      sql_state: '00000'
                      vendor_code: 0
      servers:
        - url: https://{sql_node}
          variables:
            sql_node:
              default: sql_node
      x-codeSamples:
        - lang: curl
          label: curl
          source: |
            curl -X POST https://my_sql_node.com/v1/login \
                -H "Content-Type: application/json" \
                -d '{
                    "username": "admin",
                    "password": "admin",
                    "database": "system"
                }'

````