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

# Batch YouTube Transcripts

> Fetch public captions for 1–100 bare YouTube video IDs in input order. Each row is ok, not_found, error or deferred. Reserve three credits per input row and refund every unsuccessful row. format=text joins source segments; format=segments preserves millisecond offsets and durations. language is the source-reported track name or null. JSON only; SSE is not implemented. Work that cannot start within the execution budget is deferred and unbilled. Retrying a batch with the same idempotency key replays it without new source work.

Send `ids` as an array of 1–100 bare eleven-character YouTube video IDs. Full watch URLs are rejected. Rows stay in input order. Use `format=text` (default) for joined caption text, or `format=segments` for `start_ms`, `duration_ms` and `text` on every segment. An optional `language` chooses a caption track; the returned `language` retains the provider's track name when known.

The source is the existing [ScrapeCreators transcript API](https://docs.scrapecreators.com/v1/youtube/video/transcript/). Video identity and segment timings are checked before a row can succeed. Missing captions and unavailable videos are distinguished only when the source explicitly reports them. A source failure is `error`, not an invented empty transcript.

Billing reserves **3 credits × number of input IDs** and settles at **3 credits per successful row**. `not_found`, `error` and `deferred` rows cost zero. For two IDs, send `X-Max-Credits: 6`. Duplicate input IDs are separate requested rows. The batch is not response-cached; repeat the same `Idempotency-Key` to replay a result without further work or charges.

At most four source calls run concurrently. Calls have a twelve-second timeout; no new work starts after the batch's twenty-eight-second scheduling budget. Remaining rows are returned as `deferred` and unbilled. Retry only those IDs in a new batch with a new idempotency key. Provider quota/authentication failures stop new source work. Large batches are not guaranteed to finish in one request.

This release supports JSON responses. SSE requests return 422 before billing. Through MCP use `execute_endpoint`; through the Python skill supply `--allow-mutation`, an idempotency key and the full batch credit cap.


## OpenAPI

````yaml POST /youtube/transcripts
openapi: 3.1.0
info:
  title: SocialQuery API
  version: '2026-10-09'
  description: >-
    Documented requests for public-source records. Inspect accepted inputs and
    credit amounts, then verify the selected operation before integrating
    preview coverage.
servers:
  - url: https://socialquery.dev/v1
security:
  - apiKey: []
paths:
  /youtube/transcripts:
    post:
      tags:
        - YouTube
      summary: YouTube Transcripts
      description: >-
        Fetch public captions for 1–100 bare YouTube video IDs in input order.
        Each row is ok, not_found, error or deferred. Reserve three credits per
        input row and refund every unsuccessful row. format=text joins source
        segments; format=segments preserves millisecond offsets and durations.
        language is the source-reported track name or null. JSON only; SSE is
        not implemented. Work that cannot start within the execution budget is
        deferred and unbilled. Retrying a batch with the same idempotency key
        replays it without new source work.
      operationId: post_youtube_transcripts
      parameters:
        - name: Cache-Control
          in: header
          required: false
          example: no-cache
          schema:
            type: string
        - name: Idempotency-Key
          in: header
          required: false
          example: 7a5e1b4c-2d8f-4a3b-9c1e-6e8b4d2a1f3c
          schema:
            type: string
        - name: X-Max-Credits
          in: header
          required: false
          description: >-
            Optional nonnegative integer cap on the maximum request hold. A live
            request whose hold exceeds this cap returns 422
            CREDIT_BUDGET_EXCEEDED before spending. Metered holds use the
            requested limit; cache hits and successful idempotent replays cost
            zero.
          schema:
            type: integer
            minimum: 0
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - ids
              properties:
                ids:
                  type: array
                  minItems: 1
                  maxItems: 100
                  items:
                    type: string
                    pattern: ^[A-Za-z0-9_-]{11}$
                  example:
                    - bjVIDXPP7Uk
                    - '00000000000'
                language:
                  type: string
                  pattern: ^[a-zA-Z]{2,3}(-[a-zA-Z0-9]{2,8})*$
                  example: en
                format:
                  type: string
                  enum:
                    - text
                    - segments
                  default: text
      responses:
        '200':
          description: >-
            Fetch public captions for 1–100 bare YouTube video IDs in input
            order. Each row is ok, not_found, error or deferred. Reserve three
            credits per input row and refund every unsuccessful row. format=text
            joins source segments; format=segments preserves millisecond offsets
            and durations. language is the source-reported track name or null.
            JSON only; SSE is not implemented. Work that cannot start within the
            execution budget is deferred and unbilled. Retrying a batch with the
            same idempotency key replays it without new source work.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SocialQueryResponse'
                  - type: object
                    properties:
                      data:
                        type: object
                        properties:
                          items:
                            type: array
                            items:
                              type: object
                              required:
                                - id
                                - status
                                - transcript
                                - language
                                - ext
                              properties:
                                id:
                                  type: string
                                status:
                                  type: string
                                  enum:
                                    - ok
                                    - not_found
                                    - error
                                    - deferred
                                transcript:
                                  oneOf:
                                    - type: 'null'
                                    - type: string
                                    - type: array
                                      items:
                                        type: object
                                        required:
                                          - start_ms
                                          - duration_ms
                                          - text
                                        properties:
                                          start_ms:
                                            type: number
                                            minimum: 0
                                          duration_ms:
                                            type: number
                                            minimum: 0
                                          text:
                                            type: string
                                language:
                                  type:
                                    - string
                                    - 'null'
                                ext:
                                  type: object
                                  properties:
                                    reason:
                                      type: string
                          returned_count:
                            type: integer
                          succeeded:
                            type: integer
                          format:
                            type: string
                            enum:
                              - text
                              - segments
                          next_cursor:
                            type: 'null'
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '402':
          $ref: '#/components/responses/Error402'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '405':
          $ref: '#/components/responses/Error405'
        '409':
          $ref: '#/components/responses/Error409'
        '422':
          $ref: '#/components/responses/Error422'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
        '502':
          $ref: '#/components/responses/Error502'
        '503':
          $ref: '#/components/responses/Error503'
        '504':
          $ref: '#/components/responses/Error504'
components:
  schemas:
    SocialQueryResponse:
      type: object
      required:
        - success
        - platform
        - endpoint
        - credits_used
        - credits_remaining
        - request_id
        - cached
        - data
      properties:
        success:
          type: boolean
          const: true
        platform:
          type: string
        endpoint:
          type: string
        credits_used:
          type: integer
          minimum: 0
        credits_remaining:
          type:
            - integer
            - 'null'
        request_id:
          type: string
        cached:
          type: boolean
        data:
          type: object
          additionalProperties: true
          description: >-
            The selected operation determines the resource fields in this
            object. Source data can omit a metric or report it as null.
    SocialQueryError:
      type: object
      required:
        - success
        - platform
        - endpoint
        - credits_used
        - credits_remaining
        - request_id
        - cached
        - error
      properties:
        success:
          type: boolean
          const: false
        platform:
          type: string
        endpoint:
          type: string
        credits_used:
          type: integer
          minimum: 0
        credits_remaining:
          type:
            - integer
            - 'null'
        request_id:
          type: string
        cached:
          type: boolean
        error:
          type: object
          required:
            - code
            - type
            - message
            - status
            - doc_url
          properties:
            code:
              type: string
            type:
              type: string
            message:
              type: string
            status:
              type: integer
            doc_url:
              type: string
              format: uri
  responses:
    Error400:
      description: Upstream rejected the request.
      headers:
        X-Request-Id:
          schema:
            type: string
        X-Credits-Used:
          schema:
            type: integer
        X-Credits-Remaining:
          schema:
            type: string
        X-Cache:
          schema:
            type: string
            enum:
              - HIT
              - MISS
              - BYPASS
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SocialQueryError'
    Error401:
      description: Missing, expired, invalid, or revoked API key.
      headers:
        X-Request-Id:
          schema:
            type: string
        X-Credits-Used:
          schema:
            type: integer
        X-Credits-Remaining:
          schema:
            type: string
        X-Cache:
          schema:
            type: string
            enum:
              - HIT
              - MISS
              - BYPASS
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SocialQueryError'
    Error402:
      description: Insufficient SocialQuery credits.
      headers:
        X-Request-Id:
          schema:
            type: string
        X-Credits-Used:
          schema:
            type: integer
        X-Credits-Remaining:
          schema:
            type: string
        X-Cache:
          schema:
            type: string
            enum:
              - HIT
              - MISS
              - BYPASS
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SocialQueryError'
    Error403:
      description: Key scope or provider policy denied access.
      headers:
        X-Request-Id:
          schema:
            type: string
        X-Credits-Used:
          schema:
            type: integer
        X-Credits-Remaining:
          schema:
            type: string
        X-Cache:
          schema:
            type: string
            enum:
              - HIT
              - MISS
              - BYPASS
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SocialQueryError'
    Error404:
      description: Endpoint or upstream resource not found.
      headers:
        X-Request-Id:
          schema:
            type: string
        X-Credits-Used:
          schema:
            type: integer
        X-Credits-Remaining:
          schema:
            type: string
        X-Cache:
          schema:
            type: string
            enum:
              - HIT
              - MISS
              - BYPASS
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SocialQueryError'
    Error405:
      description: HTTP method is not supported.
      headers:
        X-Request-Id:
          schema:
            type: string
        X-Credits-Used:
          schema:
            type: integer
        X-Credits-Remaining:
          schema:
            type: string
        X-Cache:
          schema:
            type: string
            enum:
              - HIT
              - MISS
              - BYPASS
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SocialQueryError'
    Error409:
      description: Idempotency conflict or request in progress.
      headers:
        X-Request-Id:
          schema:
            type: string
        X-Credits-Used:
          schema:
            type: integer
        X-Credits-Remaining:
          schema:
            type: string
        X-Cache:
          schema:
            type: string
            enum:
              - HIT
              - MISS
              - BYPASS
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SocialQueryError'
    Error422:
      description: Invalid parameters.
      headers:
        X-Request-Id:
          schema:
            type: string
        X-Credits-Used:
          schema:
            type: integer
        X-Credits-Remaining:
          schema:
            type: string
        X-Cache:
          schema:
            type: string
            enum:
              - HIT
              - MISS
              - BYPASS
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SocialQueryError'
    Error429:
      description: Request limit reached.
      headers:
        X-Request-Id:
          schema:
            type: string
        X-Credits-Used:
          schema:
            type: integer
        X-Credits-Remaining:
          schema:
            type: string
        X-Cache:
          schema:
            type: string
            enum:
              - HIT
              - MISS
              - BYPASS
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SocialQueryError'
    Error500:
      description: Request processing failed.
      headers:
        X-Request-Id:
          schema:
            type: string
        X-Credits-Used:
          schema:
            type: integer
        X-Credits-Remaining:
          schema:
            type: string
        X-Cache:
          schema:
            type: string
            enum:
              - HIT
              - MISS
              - BYPASS
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SocialQueryError'
    Error502:
      description: Upstream service failed.
      headers:
        X-Request-Id:
          schema:
            type: string
        X-Credits-Used:
          schema:
            type: integer
        X-Credits-Remaining:
          schema:
            type: string
        X-Cache:
          schema:
            type: string
            enum:
              - HIT
              - MISS
              - BYPASS
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SocialQueryError'
    Error503:
      description: Provider or required service is unavailable.
      headers:
        X-Request-Id:
          schema:
            type: string
        X-Credits-Used:
          schema:
            type: integer
        X-Credits-Remaining:
          schema:
            type: string
        X-Cache:
          schema:
            type: string
            enum:
              - HIT
              - MISS
              - BYPASS
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SocialQueryError'
    Error504:
      description: Upstream service timed out.
      headers:
        X-Request-Id:
          schema:
            type: string
        X-Credits-Used:
          schema:
            type: integer
        X-Credits-Remaining:
          schema:
            type: string
        X-Cache:
          schema:
            type: string
            enum:
              - HIT
              - MISS
              - BYPASS
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SocialQueryError'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````

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