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

# Connect a ChatGPT Ads (OpenAI Ads Manager) account with its API key

> Body: `profileId` and `apiKey`, an Ads API key created in OpenAI Ads Manager → Settings → API keys (ads.openai.com/settings). A key opens exactly one ad account: connect several accounts with one key each. A platform.openai.com key is refused.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/connect/chatgpt_ads
openapi: 3.0.0
info:
  title: PlugKit API
  description: >-
    One API to publish, schedule and message across Instagram, Facebook,
    Threads, WhatsApp, TikTok, Telegram, YouTube, X, LinkedIn and Bluesky — and
    to run Meta and Google ads.
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.plugkit.co
security: []
tags: []
paths:
  /v1/connect/chatgpt_ads:
    post:
      tags:
        - connect
      summary: Connect a ChatGPT Ads (OpenAI Ads Manager) account with its API key
      description: >-
        Body: `profileId` and `apiKey`, an Ads API key created in OpenAI Ads
        Manager → Settings → API keys (ads.openai.com/settings). A key opens
        exactly one ad account: connect several accounts with one key each. A
        platform.openai.com key is refused.
      operationId: ConnectController_connectChatGptAds
      parameters: []
      responses:
        '201':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: >-
                      Human-readable confirmation. Informative only: do not
                      parse.
                    example: Account connected
                  account:
                    $ref: '#/components/schemas/Account'
                required:
                  - message
                  - account
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/RateLimited'
        '502':
          $ref: '#/components/responses/PlatformError'
      security:
        - api-key: []
components:
  schemas:
    Account:
      type: object
      properties:
        _id:
          type: string
          example: cm3acc0000001
        platform:
          type: string
          example: instagram
          enum:
            - instagram
            - whatsapp
            - tiktok
            - telegram
            - youtube
            - x
            - facebook
            - meta_ads
            - linkedin
            - threads
            - bluesky
            - google_ads
            - chatgpt_ads
            - tiktok_ads
        profileId:
          type: string
          example: cm3prof000001
        externalId:
          type: string
          example: '17841400000000000'
          description: Id of the account on its platform.
        username:
          type: string
          example: acme
        displayName:
          type: string
          nullable: true
          example: Acme
        profilePicture:
          type: string
          format: uri
          nullable: true
        profileUrl:
          type: string
          format: uri
          example: https://instagram.com/acme
          nullable: true
        isActive:
          type: boolean
          example: true
        needsReconnection:
          type: boolean
          example: false
        disconnectedReason:
          type: string
          description: Only when not active, if known.
        disconnectedAt:
          type: string
          description: Only when not active, if known.
        reconnectUrl:
          type: string
          format: uri
          description: 'Only when not active: where the user reconnects it.'
        metadata:
          $ref: '#/components/schemas/AccountMetadata'
        billing:
          $ref: '#/components/schemas/AccountXBilling'
        createdAt:
          type: string
          format: date-time
          example: '2026-11-10T09:30:00.000Z'
        updatedAt:
          type: string
          format: date-time
          example: '2026-11-10T09:30:00.000Z'
      required:
        - _id
        - platform
        - profileId
        - externalId
        - username
        - displayName
        - profilePicture
        - profileUrl
        - isActive
        - needsReconnection
        - createdAt
        - updatedAt
    AccountMetadata:
      type: object
      description: >-
        Public platform metadata. Only keys that exist for this account are
        present.
      properties:
        avatarUrl:
          type: string
          format: uri
        scope:
          type: string
        businessAccountId:
          type: string
        phoneNumberId:
          type: string
        wabaId:
          type: string
        channelId:
          type: string
        channelUsername:
          type: string
        botUsername:
          type: string
        pageId:
          type: string
        playlistId:
          type: string
        currency:
          type: string
          example: EUR
          description: 'Ad accounts: every budget is in minor units of it.'
        businessName:
          type: string
    AccountXBilling:
      type: object
      description: >-
        X only: whether billable background work is allowed (X charges per
        call).
      properties:
        analyticsEnabled:
          type: boolean
        inboxSyncEnabled:
          type: boolean
        costAcknowledgedAt:
          type: string
          format: date-time
          example: '2026-11-10T09:30:00.000Z'
          nullable: true
      required:
        - analyticsEnabled
        - inboxSyncEnabled
        - costAcknowledgedAt
    Error:
      type: object
      description: >-
        Every error response has this shape. The request id is returned in the
        `x-request-id` header, not in the body.
      properties:
        error:
          type: string
          description: >-
            Human-readable message (English). Informative only: branch on `type`
            and `code`.
          example: scheduledFor must be a future date.
        type:
          type: string
          description: Error class, for programmatic branching.
          example: invalid_request_error
          enum:
            - invalid_request_error
            - authentication_error
            - permission_error
            - not_found
            - rate_limit_error
            - platform_error
            - billing_error
            - api_error
        code:
          type: string
          description: >-
            Stable machine code for the precise case (e.g. `validation_failed`,
            `post_not_found`, `rate_limited`, `subscription_required`).
          example: scheduled_in_past
        param:
          type: string
          description: Request field at fault, when there is one.
          example: scheduledFor
        platform:
          type: string
          description: >-
            Upstream platform (meta, tiktok, x…) when `type` is
            `platform_error`.
          example: meta
        platformError:
          type: object
          additionalProperties: true
          description: Raw error payload from the platform, passed through verbatim.
        details:
          type: object
          additionalProperties: true
          description: >-
            Extra structured context. Validation errors carry `details.fields`
            (one message per invalid field); billing errors carry
            `details.action_url`; rate limits carry `details.retryAfter`.
      required:
        - error
        - type
        - code
  responses:
    BadRequest:
      description: >-
        Invalid request. `code` is `validation_failed` for body/query validation
        (one message per field in `details.fields`), or a specific code
        (`invalid_reference`, `unsupported_for_platform`…).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 2 validation errors on the request.
            type: invalid_request_error
            code: validation_failed
            details:
              fields:
                - content should not be empty
                - accountIds must be an array
    Unauthorized:
      description: Missing, invalid or revoked API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Invalid API key.
            type: authentication_error
            code: unauthorized
    PaymentRequired:
      description: >-
        The billing state forbids this call (no plan, unpaid subscription,
        account quota reached, X spend cap reached…). `details.action_url` says
        where to unblock it.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: >-
              Paid X API calls require a PlugKit plan — they stay locked during
              the free trial.
            type: billing_error
            code: subscription_required
            details:
              action_url: https://plugkit.co/dashboard/billing
    RateLimited:
      description: >-
        Too many requests (PlugKit per-minute quota, or the shared platform
        quota nearly exhausted). Wait `retry-after` seconds.
      headers:
        retry-after:
          description: Seconds to wait before retrying.
          schema:
            type: integer
        x-ratelimit-limit:
          description: Requests allowed per minute in this bucket.
          schema:
            type: integer
        x-ratelimit-remaining:
          schema:
            type: integer
        x-ratelimit-reset:
          description: Unix time (seconds) when the window resets.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 'Rate limit exceeded: 60 write requests per minute. Retry in 12s.'
            type: rate_limit_error
            code: rate_limited
            details:
              limit: 60
              bucket: write
              retryAfter: 12
    PlatformError:
      description: >-
        The upstream platform refused the call. Its raw payload is in
        `platformError`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Invalid OAuth access token.
            type: platform_error
            code: platform_request_failed
            platform: meta
            platformError:
              code: 190
              message: Invalid OAuth access token.
  securitySchemes:
    api-key:
      scheme: bearer
      bearerFormat: sk_...
      type: http

````

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