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

# Create a connect session

> Create a new connect session

<Info>
  Requires an API key with the `environment:connect_sessions:write` scope. [Learn more about API key scopes](/reference/backend/http-api/api-keys#scopes).
</Info>

Creates a short-lived connect session (30m).
The returned token can be used for instance to create connections through Connect UI.

You can attach connection-level tags to the session via the `tags` field. These tags are copied onto the created connection and included in auth webhooks.

Most apps start with these tags: `end_user_id`, `end_user_email`, `organization_id`.


## OpenAPI

````yaml POST /connect/sessions
openapi: 3.1.0
info:
  title: Nango API
  description: Nango API specs used to authorize & sync data with external APIs.
  version: 1.0.0
servers:
  - url: https://api.nango.dev
    description: Production server
  - url: http://localhost:3003
    description: Local server
security:
  - bearerAuth: []
externalDocs:
  url: https://nango.dev/docs/reference/backend/http-api/authentication
paths:
  /connect/sessions:
    post:
      summary: Create connect session
      description: Create a new connect session
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConnectSessionInput'
      responses:
        '201':
          description: Successfully created a connect session
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/ConnectSession'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    ConnectSessionInput:
      type: object
      properties:
        tags:
          $ref: '#/components/schemas/Tags'
        end_user:
          allOf:
            - $ref: '#/components/schemas/EndUser'
          deprecated: true
          description: Deprecated, use tags instead
        organization:
          type: object
          deprecated: true
          description: Deprecated, use tags instead
          required:
            - id
          properties:
            id:
              type: string
              description: Uniquely identifies the organization the end user belongs to
            display_name:
              type: string
        allowed_integrations:
          type: array
          description: Filters which integrations the end user can interact with
          items:
            type: string
        integrations_config_defaults:
          type: object
          additionalProperties:
            type: object
            description: the unique name of an integration
            additionalProperties: false
            properties:
              user_scopes:
                type: string
                description: User scopes (for Slack only)
              authorization_params:
                type: object
                description: Query params passed to the OAuth flow (for OAuth2 only)
                additionalProperties: true
              connection_config:
                type: object
                additionalProperties: true
                properties:
                  oauth_scopes_override:
                    type: string
                    description: Override oauth scopes
                  oauth_client_id_override:
                    type: string
                    description: >-
                      Set to empty string to allow end-users to provide their
                      own OAuth client ID in Connect UI
                  oauth_client_secret_override:
                    type: string
                    description: >-
                      Set to empty string to allow end-users to provide their
                      own OAuth client secret in Connect UI
        overrides:
          type: object
          additionalProperties:
            type: object
            description: The unique name of an integration
            additionalProperties: false
            properties:
              docs_connect:
                type: string
                description: Override the url of the docs we point to in the connect flow
    ConnectSession:
      type: object
      required:
        - token
        - expires_at
      properties:
        token:
          type: string
          description: The connect session token
        connect_link:
          type: string
          description: >-
            The URL to directly connect the user to the integration. This can be
            used as a magic link.
        expires_at:
          type: string
          description: When the token expires
          format: date-time
    Tags:
      type: object
      description: Connection tags (key/value strings). Keys are normalized to lowercase.
      maxProperties: 10
      additionalProperties:
        type: string
        maxLength: 255
    EndUser:
      type: object
      deprecated: true
      required:
        - id
      properties:
        id:
          type: string
          description: Uniquely identifies the end user.
          deprecated: true
        email:
          type: string
          deprecated: true
        display_name:
          type: string
          deprecated: true
        tags:
          type: object
          additionalProperties:
            type: string
            maxLength: 64
          description: >-
            Tags associated with the end user. Only accepts strings values, up
            to 64 keys.
          deprecated: true
    StdError:
      type: object
      additionalProperties: false
      properties:
        error:
          type: object
          additionalProperties: false
          required:
            - code
          properties:
            code:
              type: string
            message:
              type: string
            errors:
              type: array
              items:
                type: object
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StdError'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StdError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: The secret key from your Nango environment.

````