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

# Begin OAuth connection

> Start an OAuth attempt and return the authorization details.



## OpenAPI

````yaml /openapi.json post /api/integration/{integrationID}/connect/oauth
openapi: 3.1.0
info:
  title: opencode HttpApi
  version: 0.0.1
  description: Experimental HttpApi surface for selected instance routes.
servers: []
security: []
tags:
  - name: health
  - name: server
  - name: location
  - name: agent
  - name: plugin
    description: Experimental plugin routes.
  - name: session
    description: Experimental session routes.
  - name: session
    description: Experimental message routes.
  - name: model
    description: Experimental model routes.
  - name: generate
    description: Experimental one-shot generation routes.
  - name: provider
    description: Experimental provider routes.
  - name: integration
    description: Integration discovery and authentication routes.
  - name: mcp
    description: MCP server and resource routes.
  - name: credential
  - name: project
    description: Location-scoped project routes.
  - name: form
    description: Session form routes.
  - name: permission
    description: Experimental permission routes.
  - name: filesystem
    description: Experimental location-scoped filesystem routes.
  - name: command
    description: Experimental command routes.
  - name: skill
    description: Experimental skill routes.
  - name: event
    description: Experimental event stream routes.
  - name: pty
    description: Experimental location-scoped PTY routes.
  - name: shell
    description: Experimental location-scoped shell command routes.
  - name: question
    description: Experimental session question routes.
  - name: reference
    description: Location-scoped project references.
  - name: projectCopy
    description: Project copy management routes.
  - name: vcs
    description: Location-scoped version control routes.
  - name: debug
paths:
  /api/integration/{integrationID}/connect/oauth:
    post:
      tags:
        - integration
      summary: Begin OAuth connection
      description: Start an OAuth attempt and return the authorization details.
      operationId: v2.integration.connect.oauth
      parameters:
        - name: integrationID
          in: path
          schema:
            type: string
          required: true
        - name: location
          in: query
          schema:
            anyOf:
              - type: object
                properties:
                  directory:
                    anyOf:
                      - type: string
                      - type: 'null'
                  workspace:
                    anyOf:
                      - type: string
                      - type: 'null'
                additionalProperties: false
              - type: 'null'
          required: false
          style: deepObject
          explode: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                methodID:
                  type: string
                inputs:
                  type: object
                  additionalProperties:
                    type: string
                label:
                  anyOf:
                    - type: string
                    - type: 'null'
              required:
                - methodID
                - inputs
              additionalProperties: false
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  location:
                    $ref: '#/components/schemas/Location.Info'
                  data:
                    $ref: '#/components/schemas/Integration.Attempt'
                required:
                  - location
                  - data
                additionalProperties: false
        '400':
          description: InvalidRequestError
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/InvalidRequestError1'
                  - $ref: '#/components/schemas/InvalidRequestError'
        '401':
          description: UnauthorizedError
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
      security: []
components:
  schemas:
    Location.Info:
      type: object
      properties:
        directory:
          type: string
        workspaceID:
          type: string
          allOf:
            - pattern: ^wrk
        project:
          type: object
          properties:
            id:
              type: string
            directory:
              type: string
          required:
            - id
            - directory
          additionalProperties: false
      required:
        - directory
        - project
      additionalProperties: false
    Integration.Attempt:
      type: object
      properties:
        attemptID:
          type: string
        url:
          type: string
        instructions:
          type: string
        mode:
          type: string
          enum:
            - auto
            - code
        time:
          type: object
          properties:
            created:
              anyOf:
                - anyOf:
                    - type: number
                    - type: string
                      enum:
                        - NaN
                    - type: string
                      enum:
                        - Infinity
                    - type: string
                      enum:
                        - '-Infinity'
                - type: string
                  enum:
                    - Infinity
                    - '-Infinity'
                    - NaN
            expires:
              anyOf:
                - anyOf:
                    - type: number
                    - type: string
                      enum:
                        - NaN
                    - type: string
                      enum:
                        - Infinity
                    - type: string
                      enum:
                        - '-Infinity'
                - type: string
                  enum:
                    - Infinity
                    - '-Infinity'
                    - NaN
          required:
            - created
            - expires
          additionalProperties: false
      required:
        - attemptID
        - url
        - instructions
        - mode
        - time
      additionalProperties: false
    InvalidRequestError1:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - InvalidRequestError
        message:
          type: string
        kind:
          anyOf:
            - type: string
            - type: 'null'
        field:
          anyOf:
            - type: string
            - type: 'null'
      required:
        - _tag
        - message
      additionalProperties: false
    InvalidRequestError:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - InvalidRequestError
        message:
          type: string
        kind:
          anyOf:
            - type: string
            - type: 'null'
        field:
          anyOf:
            - type: string
            - type: 'null'
      required:
        - _tag
        - message
      additionalProperties: false
    UnauthorizedError:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - UnauthorizedError
        message:
          type: string
      required:
        - _tag
        - message
      additionalProperties: false

````