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

# Create Connected Org

> Add a new connected org and automatically trigger a full scan.

Owner/Admin only (session auth): registering an org submits a platform
credential, expands scan scope, and consumes the plan repo cap — a mutation
the workspace role model reserves for Admin/Owner. API-key auth is
owner-equivalent and bypasses the role check.

Accepts two auth modes:
  - PAT mode:   body contains url + access_token
  - OAuth mode: body contains oauth_org_login (uses the user's linked identity token)

A full scan is automatically queued after the org is created. The response
includes ``initial_scan_id`` which can be used to poll scan progress via
GET /api/v1/scans/{scan_id}.



## OpenAPI

````yaml /openapi.json post /api/v1/connected-orgs
openapi: 3.1.0
info:
  description: Change Impact Engine for multi-repo systems
  title: Riftmap
  version: 1.12.3
servers: []
security: []
paths:
  /api/v1/connected-orgs:
    post:
      tags:
        - connected-orgs
      summary: Create Connected Org
      description: >-
        Add a new connected org and automatically trigger a full scan.


        Owner/Admin only (session auth): registering an org submits a platform

        credential, expands scan scope, and consumes the plan repo cap — a
        mutation

        the workspace role model reserves for Admin/Owner. API-key auth is

        owner-equivalent and bypasses the role check.


        Accepts two auth modes:
          - PAT mode:   body contains url + access_token
          - OAuth mode: body contains oauth_org_login (uses the user's linked identity token)

        A full scan is automatically queued after the org is created. The
        response

        includes ``initial_scan_id`` which can be used to poll scan progress via

        GET /api/v1/scans/{scan_id}.
      operationId: create_connected_org_api_v1_connected_orgs_post
      parameters:
        - in: header
          name: X-Workspace-Id
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Workspace-Id
        - in: cookie
          name: riftmap_access
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Riftmap Access
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConnectedOrgCreate'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectedOrgResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - APIKeyHeader: []
        - HTTPBearer: []
components:
  schemas:
    ConnectedOrgCreate:
      description: |-
        Request body for registering a new connected org.

        Two mutually exclusive auth modes:
          PAT mode   — provide url + access_token (power users, self-hosted)
          OAuth mode — provide oauth_org_login (uses the user's linked identity token)
      properties:
        access_token:
          anyOf:
            - type: string
            - type: 'null'
          title: Access Token
        name:
          title: Name
          type: string
        oauth_org_login:
          anyOf:
            - type: string
            - type: 'null'
          title: Oauth Org Login
        platform:
          default: gitlab
          title: Platform
          type: string
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
      required:
        - name
      title: ConnectedOrgCreate
      type: object
    ConnectedOrgResponse:
      description: Response schema for a connected org (list/get endpoints).
      properties:
        created_at:
          format: date-time
          title: Created At
          type: string
        heuristic_patterns:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Heuristic Patterns
        id:
          format: uuid
          title: Id
          type: string
        initial_scan_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          title: Initial Scan Id
        name:
          title: Name
          type: string
        platform:
          title: Platform
          type: string
        platform_id:
          title: Platform Id
          type: string
        updated_at:
          format: date-time
          title: Updated At
          type: string
        url:
          title: Url
          type: string
        workspace_id:
          format: uuid
          title: Workspace Id
          type: string
      required:
        - id
        - workspace_id
        - platform
        - platform_id
        - name
        - url
        - created_at
        - updated_at
      title: ConnectedOrgResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    APIKeyHeader:
      in: header
      name: X-API-Key
      type: apiKey
    HTTPBearer:
      description: API key as Bearer token (rfm_live_... prefix)
      scheme: bearer
      type: http

````