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

# Create a connection

> Starts connecting to an MCP server that acts as one of its users. Send the user's browser to `consent_url`. Once they consent, they get a `confirmation`: as a code shown to them, to give back to you, or, if you passed the optional `return_url`, sent to it with `connection_id`. Confirm the connection with it within 10 minutes to make it `active`, then give its `id` to runs as `connection_id`.



## OpenAPI

````yaml https://tracks.alpic.ai/api/openapi.json post /connections
openapi: 3.1.0
info:
  title: Tracks API
  version: 0.0.1
  description: >-
    Run coding agents such as Claude Code in isolated sandboxes with an API key
    of your organization. Create a run with a prompt, then follow its output and
    what it costs, or launch an experiment to compare agents on your scenarios.
servers:
  - url: https://tracks.alpic.ai/api
security: []
tags:
  - name: Runs
    description: Start coding agents and follow their work.
  - name: Files
    description: Upload files to place in a run's sandbox.
  - name: Connections
    description: >-
      Let agents use MCP servers as one of their users, without their
      credentials entering the sandbox.
  - name: Experiments
    description: >-
      Define scenarios to give several agents in several variants, judged on
      what they did.
  - name: Executions
    description: Launch experiments and read their results.
  - name: Library
    description: What your experiments can give their agents.
  - name: System
paths:
  /connections:
    post:
      tags:
        - Connections
      summary: Create a connection
      description: >-
        Starts connecting to an MCP server that acts as one of its users. Send
        the user's browser to `consent_url`. Once they consent, they get a
        `confirmation`: as a code shown to them, to give back to you, or, if you
        passed the optional `return_url`, sent to it with `connection_id`.
        Confirm the connection with it within 10 minutes to make it `active`,
        then give its `id` to runs as `connection_id`.
      operationId: connections.create
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateConnectionInput'
        required: true
      responses:
        '201':
          description: CreatedConnection
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatedConnection'
        '400':
          description: >-
            The request is invalid: a value is missing, has the wrong type or is
            out of range. Fix it before sending the request again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidRequestEncoded'
        '401':
          description: >-
            The API key is missing, malformed or revoked, or its organization is
            closed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyRefusedEncoded'
        '422':
          description: >-
            The connection cannot be started: the return URL is not allowed, or
            the MCP server cannot be authorized in a way we support.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionRefusedEncoded'
        '502':
          description: The MCP server or its authorization server could not be reached.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServerUnreachableEncoded'
      security:
        - bearer: []
components:
  schemas:
    CreateConnectionInput:
      type: object
      properties:
        server_url:
          type: string
        return_url:
          type: string
      required:
        - server_url
      additionalProperties: false
    CreatedConnection:
      type: object
      properties:
        connection:
          anyOf:
            - $ref: '#/components/schemas/WorkingConnection'
            - $ref: '#/components/schemas/FailedConnection'
          description: Access to an MCP server as one of its users, kept by us.
        consent_url:
          type: string
          description: >-
            Send the user's browser there to consent on the MCP server. Valid
            for 10 minutes, once. The browser then comes back to your
            `return_url`, or shows the confirmation code without one.
      required:
        - connection
        - consent_url
      additionalProperties: false
    InvalidRequestEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - InvalidRequest
        message:
          type: string
          description: Every problem found, in one sentence.
        location:
          type: string
          enum:
            - path
            - query
            - header
            - body
          description: The part of the request that is wrong.
        issues:
          type: array
          items:
            $ref: '#/components/schemas/RequestIssue'
          description: Each problem found, with where it is.
      required:
        - _tag
        - message
        - location
        - issues
      additionalProperties: false
    ApiKeyRefusedEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - ApiKeyRefused
        message:
          type: string
      required:
        - _tag
        - message
      additionalProperties: false
    ConnectionRefusedEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - ConnectionRefused
        message:
          type: string
      required:
        - _tag
        - message
      additionalProperties: false
    ServerUnreachableEncoded:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - ServerUnreachable
        message:
          type: string
      required:
        - _tag
        - message
      additionalProperties: false
    WorkingConnection:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/ConnectionId_2'
        server_url:
          type: string
          description: URL of the MCP server.
        created_at:
          type: string
        status:
          type: string
          enum:
            - authorizing
            - unconfirmed
            - active
          description: >-
            `authorizing` until the user consents on the MCP server,
            `unconfirmed` until you confirm it, `active` once it can be used.
      required:
        - id
        - server_url
        - created_at
        - status
      additionalProperties: false
      description: A connection that has not failed.
    FailedConnection:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/ConnectionId_2'
        server_url:
          type: string
          description: URL of the MCP server.
        created_at:
          type: string
        status:
          type: string
          enum:
            - failed
        failure:
          type: string
          description: Why the consent did not complete.
      required:
        - id
        - server_url
        - created_at
        - status
        - failure
      additionalProperties: false
      description: A connection whose consent did not complete.
    RequestIssue:
      type: object
      properties:
        path:
          type: array
          items:
            anyOf:
              - type: string
              - type: number
              - type: string
                enum:
                  - Infinity
                  - '-Infinity'
                  - NaN
          description: >-
            Keys leading to the wrong value inside that part of the request,
            such as `["agent", "model"]`. Empty when the problem concerns that
            part as a whole.
        message:
          type: string
          description: What is wrong with the value.
      required:
        - path
        - message
      additionalProperties: false
      description: One problem found in the request.
    ConnectionId_2:
      type: string
      description: Unique identifier of the connection.
  securitySchemes:
    bearer:
      description: >-
        An API key of your organization, starting with `trk_`, sent as
        `Authorization: Bearer <key>`.
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.