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

# Register a code host app

> Register or update a provider's OAuth app.

An empty secret keeps the stored one. Changing the client ID or the
directory drops everyone's sign-ins, because their tokens belong to
the old app.



## OpenAPI

````yaml put /api/code-hosts/apps/{provider}
openapi: 3.1.0
info:
  title: Nx1 AI API
  description: |

    AI API for Nx1 Data Platform Management and Automated Data Tasks.

    Authentication is required via PSK in Authorization header.

    Default PSK is | [ask a friend] |
  version: 0.10.2
servers: []
security: []
paths:
  /api/code-hosts/apps/{provider}:
    put:
      tags:
        - Code hosts
      summary: Register a code host app
      description: |-
        Register or update a provider's OAuth app.

        An empty secret keeps the stored one. Changing the client ID or the
        directory drops everyone's sign-ins, because their tokens belong to
        the old app.
      operationId: put_app_api_code_hosts_apps__provider__put
      parameters:
        - name: provider
          in: path
          required: true
          schema:
            type: string
            description: github, gitlab, azure_devops, bitbucket
            title: Provider
          description: github, gitlab, azure_devops, bitbucket
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CodeHostAppRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CodeHostAppStatus'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Conflict
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Content
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    CodeHostAppRequest:
      properties:
        client_id:
          type: string
          maxLength: 256
          title: Client Id
          default: ''
        client_secret:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: Client Secret
          description: Write-only. Empty keeps the stored one.
        base_url:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: Base Url
          description: A self-hosted host's base URL.
        directory:
          anyOf:
            - type: string
              maxLength: 128
            - type: 'null'
          title: Directory
          description: Azure DevOps' Entra directory.
      type: object
      title: CodeHostAppRequest
      description: Register a provider's OAuth app.
    CodeHostAppStatus:
      properties:
        provider:
          type: string
          title: Provider
        label:
          type: string
          title: Label
        registered:
          type: boolean
          title: Registered
        client_id:
          type: string
          title: Client Id
          default: ''
        secret_set:
          type: boolean
          title: Secret Set
          default: false
        base_url:
          type: string
          title: Base Url
          default: ''
        directory:
          type: string
          title: Directory
          default: ''
        self_hosted:
          type: boolean
          title: Self Hosted
          default: false
        supports_registration:
          type: boolean
          title: Supports Registration
          default: false
        console_url:
          type: string
          title: Console Url
          default: ''
        setup_steps:
          items:
            type: string
          type: array
          title: Setup Steps
        redirect_uri:
          type: string
          title: Redirect Uri
          default: ''
        connected_people:
          type: integer
          title: Connected People
          default: 0
        registered_by:
          type: string
          title: Registered By
          default: ''
      type: object
      required:
        - provider
        - label
        - registered
      title: CodeHostAppStatus
      description: A provider and whether its app is set up. Never its secret.
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
          description: A brief description of the error that occurred.
        code:
          type: integer
          title: Code
          description: The HTTP status code associated with the error.
          default: 500
      type: object
      required:
        - error
      title: ErrorResponse
  securitySchemes:
    OAuth2AuthorizationCodeBearer:
      type: oauth2
      flows:
        authorizationCode:
          scopes: {}
          authorizationUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/auth
          tokenUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/token
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization-PSK

````

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