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

# Create session by login

> Creates a new session for a user identified by login



## OpenAPI

````yaml /oss/api/openapi.yml post /v1/session/login/{login}
openapi: 3.0.3
info:
  title: Databunker API
  description: >
    Databunker is a super-fast, open-source vault built with Go for secure
    storage of sensitive personal records.


    ## Authentication

    All API requests require authentication using the `X-Bunker-Token` header.
    This token is your root access token.


    ## Content Types

    The API supports the following content types for POST and PUT requests:

    - `application/json`

    - `application/x-www-form-urlencoded`


    ## User Tokens

    Keep the user `{token}` generated by Databunker private, as it serves as an
    additional user identifier.

    Under GDPR, this user token is referred to as a pseudonymized identity.


    For more details, visit: https://databunker.org/
  version: 1.0.0
  contact:
    name: Databunker Support
    url: https://databunker.com
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: http://localhost:3000
    description: Local development server
security:
  - ApiKeyAuth: []
tags:
  - name: User
    description: User personal information management
  - name: User App
    description: Additional user application data
  - name: Session
    description: Secure session storage
  - name: Consent
    description: User consent management
  - name: Agreement
    description: Agreement management
  - name: Request
    description: User privacy requests (GDPR)
  - name: Audit
    description: Audit log access
  - name: Expiration
    description: Data expiration and retention
  - name: System
    description: System administration
paths:
  /v1/session/login/{login}:
    post:
      tags:
        - Session
      summary: Create session by login
      description: Creates a new session for a user identified by login
      operationId: createSessionByLogin
      parameters:
        - $ref: '#/components/parameters/Login'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SessionCreate'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/SessionCreate'
      responses:
        '200':
          description: Session created successfully
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessResponse'
                  - type: object
                    properties:
                      session:
                        type: string
                        format: uuid
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    Login:
      name: login
      in: path
      required: true
      description: User login name
      schema:
        type: string
      example: john
  schemas:
    SessionCreate:
      type: object
      properties:
        expiration:
          type: string
          description: Session TTL (e.g., '3d', '2h', '30m')
          example: 3d
        clientip:
          type: string
          description: Client IP address
        x-forwarded-for:
          type: string
          description: X-Forwarded-For header value
      additionalProperties: true
    SuccessResponse:
      type: object
      required:
        - status
      properties:
        status:
          type: string
          enum:
            - ok
          example: ok
    ErrorResponse:
      type: object
      required:
        - status
        - message
      properties:
        status:
          type: string
          enum:
            - error
          example: error
        message:
          type: string
          description: Error description
  responses:
    BadRequest:
      description: Bad request - invalid input
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            duplicate:
              summary: Duplicate user
              value:
                status: error
                message: user with this email already exists
    Unauthorized:
      description: Unauthorized - invalid or missing token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missing:
              summary: Missing token
              value:
                status: error
                message: missing X-Bunker-Token header
    NotFound:
      description: Not found - resource doesn't exist
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            notFound:
              summary: User not found
              value:
                status: error
                message: user not found
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Bunker-Token
      description: Root access token for Databunker API

````