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

# Create a connection

> `PENDING_CONSENT` until a key is set with `:setCredential` or OAuth consent completes.



## OpenAPI

````yaml /openapi-public.json post /vaults/{vault}/connections
openapi: 3.1.0
info:
  title: Akua API
  version: 1.0.0
  description: >-
    Manage installs and their asynchronous operations. Authenticate with a
    session bearer token and select a Workspace using Akua-Context.
  contact:
    name: Akua API support
    email: support@akua.dev
    url: https://docs.akua.dev/
servers:
  - url: https://api.akua.dev/v1
security: []
tags:
  - name: operations
  - name: installs
  - name: Organizations
  - name: Billing accounts
  - name: workspaces
  - name: regions
  - name: Dashboard Overview
  - name: products
  - name: offers
  - name: Order Drafts
  - name: packages
  - name: Auth
  - name: API Tokens
  - name: Quota adjustments
  - name: Workspace services
  - name: Vault connections
  - name: clusters
  - name: Node pools
  - name: Nodes
  - name: machines
  - name: Sandboxes
  - name: OpenCode Servers
  - name: vaults
  - name: vaultSecrets
paths:
  /vaults/{vault}/connections:
    post:
      tags:
        - Vault connections
      summary: Create a connection
      description: >-
        `PENDING_CONSENT` until a key is set with `:setCredential` or OAuth
        consent completes.
      operationId: connections.create
      parameters:
        - name: vault
          in: path
          schema:
            $ref: '#/components/schemas/VaultId'
          required: true
        - name: akua-context
          in: header
          schema:
            type: string
            minLength: 1
            maxLength: 53
            description: >-
              Optional workspace/scope context for the request. Carries a single
              workspace wire id (`ws_…`) today. Only needed for broad tokens - a
              workspace-owned token implies its workspace.
            examples:
              - ws_j572abc123def4
          required: false
        - name: idempotency-key
          in: header
          schema:
            type: string
            minLength: 1
            maxLength: 64
            description: >-
              Optional caller-supplied idempotency key. Any non-empty key up to
              64 characters is accepted. Endpoint-specific documentation
              describes how the key is used.
            examples:
              - create-prod-2026-05-07
          required: false
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateVaultConnectionRequest'
        required: true
      responses:
        '201':
          description: VaultConnection
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VaultConnection'
        '400':
          description: The request is malformed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiBadRequest'
        '401':
          description: Missing, invalid or expired credential.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiUnauthorized'
        '403':
          description: The credential may not act in this workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiForbidden'
        '404':
          description: The resource was not found in this workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiNotFound'
        '409':
          description: >-
            The request conflicts with existing resource state or immutable
            intent. | The resource changed since the etag the client sent; the
            current etag is in the metadata. | The idempotency key was already
            used for a different request.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/ApiConflict'
                  - $ref: '#/components/schemas/ApiPreconditionFailed'
                  - $ref: '#/components/schemas/ApiIdempotencyConflict'
        '422':
          description: The request is well-formed but cannot be processed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiUnprocessable'
        '429':
          description: The caller is over its per-minute budget.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiTooManyRequests'
        '503':
          description: The service is temporarily unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiServiceUnavailable'
      security:
        - BearerAuth: []
components:
  schemas:
    VaultId:
      type: string
      pattern: ^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$
      title: VaultId
      description: >-
        A vault id chosen by its creator, unique in the Workspace. `default` is
        the Workspace vault.
      examples:
        - default
    CreateVaultConnectionRequest:
      type: object
      properties:
        connector:
          $ref: '#/components/schemas/ConnectorSlug'
        name:
          type: string
          minLength: 1
          maxLength: 100
        owner:
          anyOf:
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - workspace
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - user
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - external_user
                external_user_id:
                  type: string
                  minLength: 1
                  maxLength: 200
              required:
                - type
                - external_user_id
              additionalProperties: false
          description: >-
            Defaults to the calling user. A user owner is always the
            authenticated caller, never a client-supplied id.
        auth_method:
          anyOf:
            - type: string
              minLength: 1
              description: >-
                Declared connector authentication method. Defaults to api_token.
                Akua delegated uses the verified signed-in person without a
                stored credential.
            - type: 'null'
      required:
        - connector
      additionalProperties: false
    VaultConnection:
      type: object
      properties:
        name:
          type: string
          description: Resource name `vaults/{vault}/connections/{connection}`.
        id:
          $ref: '#/components/schemas/ConnectionId'
        connector:
          $ref: '#/components/schemas/ConnectorSlug'
        display_name:
          type: string
          minLength: 1
          maxLength: 100
        owner:
          $ref: '#/components/schemas/ConnectionOwner'
        state:
          $ref: '#/components/schemas/ConnectionState'
        created_at:
          type: integer
          minimum: 0
          description: Unix timestamp (seconds)
        etag:
          type: string
          maxLength: 64
          description: Pass as `If-Match` on writes. OUTPUT_ONLY.
      required:
        - name
        - id
        - connector
        - display_name
        - owner
        - state
        - created_at
        - etag
      additionalProperties: false
    ApiBadRequest:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - Validation
        success:
          type: boolean
          enum:
            - false
        errors:
          type: array
          prefixItems:
            - $ref: '#/components/schemas/ApiErrorEntry'
          minItems: 1
          items:
            $ref: '#/components/schemas/ApiErrorEntry'
        result:
          type: object
          additionalProperties: false
      required:
        - _tag
        - success
        - errors
        - result
      additionalProperties: false
    ApiUnauthorized:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - Unauthorized
        success:
          type: boolean
          enum:
            - false
        errors:
          type: array
          prefixItems:
            - $ref: '#/components/schemas/ApiErrorEntry'
          minItems: 1
          items:
            $ref: '#/components/schemas/ApiErrorEntry'
        result:
          type: object
          additionalProperties: false
      required:
        - _tag
        - success
        - errors
        - result
      additionalProperties: false
    ApiForbidden:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - Forbidden
        success:
          type: boolean
          enum:
            - false
        errors:
          type: array
          prefixItems:
            - $ref: '#/components/schemas/ApiErrorEntry'
          minItems: 1
          items:
            $ref: '#/components/schemas/ApiErrorEntry'
        result:
          type: object
          additionalProperties: false
      required:
        - _tag
        - success
        - errors
        - result
      additionalProperties: false
    ApiNotFound:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - NotFound
        success:
          type: boolean
          enum:
            - false
        errors:
          type: array
          prefixItems:
            - $ref: '#/components/schemas/ApiErrorEntry'
          minItems: 1
          items:
            $ref: '#/components/schemas/ApiErrorEntry'
        result:
          type: object
          additionalProperties: false
      required:
        - _tag
        - success
        - errors
        - result
      additionalProperties: false
    ApiConflict:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - Conflict
        success:
          type: boolean
          enum:
            - false
        errors:
          type: array
          prefixItems:
            - $ref: '#/components/schemas/ApiErrorEntry'
          minItems: 1
          items:
            $ref: '#/components/schemas/ApiErrorEntry'
        result:
          type: object
          additionalProperties: false
      required:
        - _tag
        - success
        - errors
        - result
      additionalProperties: false
    ApiPreconditionFailed:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - PreconditionFailed
        success:
          type: boolean
          enum:
            - false
        errors:
          type: array
          prefixItems:
            - type: object
              properties:
                code:
                  type: number
                  enum:
                    - 7006
                message:
                  type: string
                metadata:
                  type: object
                  properties:
                    current_etag:
                      type: string
                  required:
                    - current_etag
                  allOf:
                    - type: object
                      additionalProperties:
                        type: string
              required:
                - code
                - message
                - metadata
              additionalProperties: false
          maxItems: 1
          minItems: 1
        result:
          type: object
          additionalProperties: false
      required:
        - _tag
        - success
        - errors
        - result
      additionalProperties: false
    ApiIdempotencyConflict:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - IdempotencyConflict
        success:
          type: boolean
          enum:
            - false
        errors:
          type: array
          prefixItems:
            - $ref: '#/components/schemas/ApiErrorEntry'
          minItems: 1
          items:
            $ref: '#/components/schemas/ApiErrorEntry'
        result:
          type: object
          additionalProperties: false
      required:
        - _tag
        - success
        - errors
        - result
      additionalProperties: false
    ApiUnprocessable:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - Unprocessable
        success:
          type: boolean
          enum:
            - false
        errors:
          type: array
          prefixItems:
            - $ref: '#/components/schemas/ApiErrorEntry'
          minItems: 1
          items:
            $ref: '#/components/schemas/ApiErrorEntry'
        result:
          type: object
          additionalProperties: false
      required:
        - _tag
        - success
        - errors
        - result
      additionalProperties: false
    ApiTooManyRequests:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - TooManyRequests
        success:
          type: boolean
          enum:
            - false
        errors:
          type: array
          prefixItems:
            - $ref: '#/components/schemas/ApiErrorEntry'
          minItems: 1
          items:
            $ref: '#/components/schemas/ApiErrorEntry'
        result:
          type: object
          additionalProperties: false
      required:
        - _tag
        - success
        - errors
        - result
      additionalProperties: false
    ApiServiceUnavailable:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - ServiceUnavailable
        success:
          type: boolean
          enum:
            - false
        errors:
          type: array
          prefixItems:
            - $ref: '#/components/schemas/ApiErrorEntry'
          minItems: 1
          items:
            $ref: '#/components/schemas/ApiErrorEntry'
        result:
          type: object
          additionalProperties: false
      required:
        - _tag
        - success
        - errors
        - result
      additionalProperties: false
    ConnectorSlug:
      type: string
      pattern: ^[a-z0-9][a-z0-9_-]{0,63}$
      title: ConnectorSlug
      description: A connector's stable slug.
      examples:
        - akua
    ConnectionId:
      type: string
      pattern: ^conn_[^\s/]{1,64}$
      title: ConnectionId
      description: A connection id
      examples:
        - conn_j572abc123def456
    ConnectionOwner:
      anyOf:
        - type: object
          properties:
            type:
              type: string
              enum:
                - workspace
          required:
            - type
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              enum:
                - user
            user_id:
              type: string
          required:
            - type
            - user_id
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              enum:
                - external_user
            external_user_id:
              type: string
          required:
            - type
            - external_user_id
          additionalProperties: false
      description: >-
        Who owns the connection: the Workspace (a shared account), one user
        (their own account) or an end customer user in a reseller vault.
    ConnectionState:
      type: string
      enum:
        - PENDING_CONSENT
        - CONNECTED
        - REAUTH_REQUIRED
        - REVOKING
        - REVOKED
        - ERROR
    ApiErrorEntry:
      type: object
      properties:
        code:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Machine-readable error code
          examples:
            - 7002
        message:
          type: string
          description: Human-readable error message
          examples:
            - Resource not found
        path:
          type: array
          items:
            type: string
          description: Field path that caused the error, when applicable
          examples:
            - - body
              - name
        metadata:
          type: object
          additionalProperties:
            type: string
      required:
        - code
        - message
      additionalProperties: false
  securitySchemes:
    BearerAuth:
      description: Bearer token for the authenticated caller.
      type: http
      scheme: bearer

````

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