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

# Obtener token de acceso

> Intercambia tu API key por un token Bearer de corta duración para autenticar las peticiones.

## Body

<ParamField body="apiKey" type="string" required>
  Tu API key generada previamente.
</ParamField>

<ResponseExample>
  ```json 200 theme={null}
  {
    "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
    "expiresIn": 3600,
    "tokenType": "Bearer"
  }
  ```
</ResponseExample>

<ResponseField name="token" type="string">
  Token JWT para usar en el header `Authorization: Bearer {token}`.
</ResponseField>

<ResponseField name="expiresIn" type="integer">
  Tiempo de expiración del token en segundos. Por defecto 3600 (1 hora).
</ResponseField>

<ResponseField name="tokenType" type="string">
  Siempre `"Bearer"`.
</ResponseField>

<Warning>
  Los tokens expiran después de 1 hora. Tu aplicación debe renovar el token antes de que expire para evitar errores `401`.
</Warning>


## OpenAPI

````yaml openapi.yml POST /auth/token
openapi: 3.1.0
info:
  title: LINA Healthcare Platform API
  version: 1.0.0
  description: |
    API de integración para la plataforma LINA Healthcare.
    Todas las rutas requieren un token JWT obtenido intercambiando una API Key.
servers:
  - url: https://api.linahealthcareplatform.com/api/v1
    description: Production
security:
  - bearerAuth: []
paths:
  /auth/token:
    post:
      tags:
        - Autenticación
      summary: Obtener token de acceso
      description: Intercambia una API Key por un JWT temporal (1h de validez)
      operationId: getToken
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - apiKey
              properties:
                apiKey:
                  type: string
                  description: Tu API Key completa (lina_sk_...)
      responses:
        '200':
          description: Token generado
          content:
            application/json:
              schema:
                type: object
                properties:
                  accessToken:
                    type: string
                  expiresIn:
                    type: integer
                    example: 3600
                  tokenType:
                    type: string
                    example: Bearer
      security: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Token JWT obtenido via POST /auth/token

````