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

# Create OAuth Credential

> Create a refresh token for the product API in an app. Exchange it at `token_endpoint` for access tokens. The refresh token is returned once



## OpenAPI

````yaml https://api.parallel.ai/account/service/openapi.json post /service/v1/apps/{app_id}/oauth-credentials
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.parallel.ai/account
    description: Parallel Account API
security: []
tags:
  - name: Apps
    description: Application management endpoints
  - name: Keys
    description: API key management endpoints
  - name: Balance
    description: Organization balance endpoints
  - name: Usage
    description: Organization usage endpoints
  - name: Service
    description: Service utility endpoints
paths:
  /service/v1/apps/{app_id}/oauth-credentials:
    post:
      tags:
        - Keys
      summary: Create OAuth Credential
      description: >-
        Create a refresh token for the product API in an app. Exchange it at
        `token_endpoint` for access tokens. The refresh token is returned once
      operationId: create_oauth_credential_service_v1_apps__app_id__oauth_credentials_post
      parameters:
        - name: app_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: App Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOAuthCredentialRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateOAuthCredentialResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    CreateOAuthCredentialRequest:
      properties:
        client_id:
          type: string
          maxLength: 128
          minLength: 1
          title: Client Id
          description: >-
            Name of the client that will hold the credential, for example
            `parallel-cli`. Shown wherever the credential is listed
        audience:
          type: string
          enum:
            - https://api.parallel.ai
            - https://api.scl124ai.com
            - https://api-aws.parallel.ai
            - https://api-aws.dev.parallel.ai
          title: Audience
          description: >-
            Product API origin the credential is for. Only the GCP and AWS
            origins of this deployment are accepted. An org on an AWS
            Marketplace listing always gets the listing's origin
        scopes:
          items:
            type: string
            const: '*'
          type: array
          minItems: 1
          title: Scopes
          description: Product API scopes. Only `*` is valid
        is_service_scoped:
          type: boolean
          title: Is Service Scoped
          description: >-
            Service credential, owned by the org and survives its creator
            leaving. Admins only
          default: false
      additionalProperties: false
      type: object
      required:
        - client_id
        - audience
        - scopes
      title: CreateOAuthCredentialRequest
      description: Request to create a shapi refresh-token credential in an app.
    CreateOAuthCredentialResponse:
      properties:
        credential_id:
          type: string
          format: uuid
          title: Credential Id
          description: >-
            Credential ID, stable across refresh-token rotation. Use it to
            revoke the credential
        client_id:
          type: string
          title: Client Id
          description: Client ID
        app_id:
          type: string
          format: uuid
          title: App Id
          description: App ID
        app_name:
          type: string
          title: App Name
          description: App Name
        created_by_user_id:
          type: string
          format: uuid
          title: Created By User Id
          description: Created by User ID
        is_service_scoped:
          type: boolean
          title: Is Service Scoped
          description: >-
            Service credential, owned by the org and survives its creator
            leaving. False: revoked when its creator leaves the org
        audience:
          type: string
          title: Audience
          description: Product API origin to send the access tokens to
        scopes:
          items:
            type: string
          type: array
          title: Scopes
          description: Granted scopes
        token_endpoint:
          type: string
          title: Token Endpoint
          description: >-
            OAuth token endpoint. Exchange the refresh token there with
            `grant_type=refresh_token`; each exchange returns a new one
        refresh_token:
          type: string
          format: password
          title: Refresh Token
          description: Refresh token
          writeOnly: true
        refresh_token_expires_at:
          type: string
          format: date-time
          title: Refresh Token Expires At
          description: Refresh token expiry. Each refresh extends it
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Created At
      type: object
      required:
        - credential_id
        - client_id
        - app_id
        - app_name
        - created_by_user_id
        - is_service_scoped
        - audience
        - scopes
        - token_endpoint
        - refresh_token
        - refresh_token_expires_at
        - created_at
      title: CreateOAuthCredentialResponse
      description: A new shapi refresh-token credential. The refresh token is shown once.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Send `Authorization: Bearer <access_token>`. This must be an account API
        access token minted via a supported Parallel OAuth grant, not a standard
        API key. See the [account API docs](/integrations/account-api).

````