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

# List collection items

> List the items of a playlist, channel, profile, album or podcast feed link, a page at a time, without downloading anything.

Send a playlist, channel, profile, album or podcast feed link and get back its items, each with a `url` you can send to [`/import`](/docs/endpoints/import), [`/transcribe`](/docs/endpoints/transcribe) or [`/metadata`](/docs/endpoints/metadata). Nothing is downloaded. A page costs \$0.003 whatever its `limit` (up to 200 items), and only a page that completes is charged.

For the next page, send the same `url` with the `nextCursor` from the previous result. `nextCursor` is `null` on the last page. A cursor only works with the `url` it came from.

A link to one video is rejected with `NOT_A_COLLECTION`, and a YouTube Mix (`list=RD…`) with `COLLECTION_NOT_SUPPORTED`; neither is charged. Which links work, what each item field means and a worked example that imports every item are on [Playlists, channels and feeds](/docs/features/collections.md).

Poll the result with [`GET /collection/status`](/docs/endpoints/collection-status), or receive it by [webhook](/docs/endpoints/webhooks/collection.md).


## OpenAPI

````yaml openapi.yaml POST /collection
openapi: 3.1.0
info:
  title: Importly API
  version: 1.0.0
  summary: Download media, get transcripts, and read metadata from a URL.
  description: >
    Importly turns a public media URL (YouTube, TikTok, podcasts and more) into
    a downloadable file,

    a transcript, or metadata.


    Every job is asynchronous. A `POST` returns a `jobId` right away. Then
    either poll the matching

    `/status` endpoint until `status` is `completed` or `failed`, or pass a
    `webhookUrl` and Importly

    posts to you once when the job finishes: the result when it succeeds, or
    `success: false` with

    `code` and `message` when it fails.


    Every response uses one envelope: `{ "success": true, "data": … }` on
    success and

    `{ "success": false, "error": "…" }` on failure. Responses carry
    `X-RateLimit-Limit`,

    `X-RateLimit-Remaining`, `X-RateLimit-Reset` (Unix time in ms) and
    `X-RateLimit-Window` headers.


    Billing is pay-as-you-go from a credit balance. New accounts get $3.00 in
    free credits, no card required.
  contact:
    name: Importly support
    email: support@importly.io
    url: https://www.importly.io/docs
servers:
  - url: https://api.importly.io
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Media
    description: Download video or audio from a URL.
  - name: Transcripts
    description: Turn a media URL into text with timestamped segments.
  - name: Metadata
    description: >-
      Read a URL's title, duration, thumbnail, formats and more without
      downloading the media.
  - name: Account
    description: Your credit balance.
  - name: Account settings
    description: >-
      Stored S3 credentials. These calls carry secrets, so the docs playground
      is off for them.
  - name: Webhooks
    description: Requests Importly sends to your `webhookUrl` when a job succeeds or fails.
paths:
  /collection:
    post:
      tags:
        - Metadata
      summary: List a collection's items
      description: >
        Lists the items in a playlist, channel, profile, album or podcast feed,
        one page at a time, each with a link

        you can send to `/import`, `/transcribe` or `/metadata`. Send the
        collection's link; to get the next page,

        send the same link again with the `nextCursor` from the previous result.


        A YouTube channel link lists the channel's videos; use its `/shorts` or
        `/streams` link for those. A watch

        link with a `list=` parameter lists that playlist. A single video's link
        is a 400 `NOT_A_COLLECTION`, and a

        YouTube mix (`list=RD…`) is a 400 `COLLECTION_NOT_SUPPORTED`: a mix is
        made for each viewer and changes on

        every visit.


        A collection lists up to 5,000 items; past that, `truncated` is `true`.
        Pages come from one snapshot of

        the collection, kept for an hour after its last page was fetched. Once
        it's gone its cursors expire: the

        job fails with `INVALID_CURSOR`, uncharged, and you list again from the
        first page.

        Durations are only known for some sites (YouTube videos, TikTok, podcast
        feeds); where `duration` is

        `null`, get it with `POST /metadata/basic`.


        Costs $0.003 per page.
      operationId: listCollectionItems
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CollectionRequest'
            examples:
              firstPage:
                summary: First page
                value:
                  url: >-
                    https://www.youtube.com/playlist?list=PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI
                  limit: 100
                  webhookUrl: https://example.com/webhooks/importly
              nextPage:
                summary: Next page
                value:
                  url: >-
                    https://www.youtube.com/playlist?list=PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI
                  cursor: >-
                    eyJ2IjoxLCJoIjoiOWI1ZTc0ZDMwYWY4ZjQ5MCIsIm8iOjEwMH0.3qv2rQ0dYw8m4cWb1uT7hA
                  limit: 100
      responses:
        '200':
          description: The collection job was queued.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueuedJobResponse'
              example:
                success: true
                data:
                  jobId: 0f8c2a51-6b0e-4c39-9d1f-2b7a4e6c9a10
                  status: queued
                  message: >-
                    Collection request queued. You will receive a webhook when
                    it's complete.
        '400':
          $ref: '#/components/responses/CollectionBadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    CollectionRequest:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          format: uri
          description: >
            The link of a playlist, channel, profile, album or podcast feed,
            e.g. a YouTube playlist or channel, a

            TikTok profile, a SoundCloud set, a Bandcamp album or a podcast's
            RSS feed. A URL on `localhost` or a

            private or internal address is a 400 `INVALID_URL`.
          example: >-
            https://www.youtube.com/playlist?list=PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI
        cursor:
          type: string
          description: >
            The `nextCursor` from the previous page's result, unchanged, sent
            with the same `url`. Leave it out for

            the first page. A cursor for another link, or changed, is a 400
            `INVALID_CURSOR`; one whose snapshot

            expired (an hour after its last page) fails the job with
            `INVALID_CURSOR`, uncharged. It works with

            any `limit`.
        limit:
          type: integer
          minimum: 1
          maximum: 200
          default: 50
          description: Items per page, from 1 to 200.
        webhookUrl:
          $ref: '#/components/schemas/WebhookUrl'
    QueuedJobResponse:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
          const: true
        data:
          type: object
          required:
            - jobId
            - status
            - message
          properties:
            jobId:
              type: string
              format: uuid
              description: Pass this as `id` to the matching status endpoint.
            status:
              type: string
              const: queued
            message:
              type: string
    WebhookUrl:
      type: string
      format: uri
      description: >
        HTTPS URL that receives the result when the job finishes. It must not
        point to a private or

        internal address. A job that fails for good sends one webhook with
        `success: false`, `code`

        and `message`.
      example: https://example.com/webhooks/importly
    Error:
      type: object
      required:
        - success
        - error
        - code
      properties:
        success:
          type: boolean
          const: false
        error:
          type: string
          description: What went wrong, in plain English.
        code:
          type: string
          description: >
            A stable, machine-readable error code: `UNAUTHORIZED`,
            `INSUFFICIENT_BALANCE`, `RATE_LIMITED`,

            `INVALID_URL`, `PLAYLIST_NOT_SUPPORTED`, `INVALID_REQUEST`,
            `NOT_FOUND` or `INTERNAL_ERROR`, and on

            `POST /collection` also `NOT_A_COLLECTION`,
            `COLLECTION_NOT_SUPPORTED` or `INVALID_CURSOR`.
          examples:
            - INVALID_URL
        documentationUrl:
          type: string
          format: uri
          description: A page explaining this error and how to fix it.
          examples:
            - https://www.importly.io/docs/errors/invalid-url
        requestId:
          type: string
          description: >-
            Only on `5xx` errors. The request's id, also sent on every response
            as the `X-Request-Id` header. Quote it to support@importly.io and we
            can find the request.
          examples:
            - req_3f9a1c7e2b8d4a60
    InsufficientBalanceError:
      allOf:
        - $ref: '#/components/schemas/Error'
        - type: object
          required:
            - code
          properties:
            code:
              type: string
              const: INSUFFICIENT_BALANCE
            endpoint:
              type: string
              description: The rate-limit bucket the request counted against.
            balanceRequired:
              type: number
              description: >-
                Minimum balance in US dollars needed to start the job. Money
                your running imports hold counts toward it.
            heldDollars:
              type: number
              description: >-
                Only when your imports still running hold part of your balance.
                What they hold, in US dollars; even with it, the balance falls
                short of `balanceRequired`.
            hint:
              type: string
              description: >-
                Only on `POST /transcribe` with `mode` `auto` when the balance
                covers the $0.003 caption price but not the $0.01 speech-to-text
                minimum. Says to send `mode` `captions` for the media's own
                captions. The same sentence ends `error`.
    RateLimitError:
      allOf:
        - $ref: '#/components/schemas/Error'
        - type: object
          properties:
            limit:
              type: integer
              description: Requests allowed per window.
            remaining:
              type: integer
              description: Requests left in the window.
            reset:
              type: integer
              description: When the window resets, as Unix time in milliseconds.
            retryAfter:
              type: integer
              description: Seconds to wait before retrying.
            endpoint:
              type: string
              description: The rate-limit bucket the request counted against.
            outstandingLimit:
              type: integer
              description: >-
                Present instead of `limit` when too many of your jobs of this
                kind are queued or running; the most allowed at once.
            outstanding:
              type: integer
              description: >-
                Present with `outstandingLimit`. How many of your jobs of this
                kind are queued or running.
  responses:
    CollectionBadRequest:
      description: A parameter is missing or invalid, or the link can't be listed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            missingUrl:
              summary: Missing url
              value:
                success: false
                error: 'Missing required parameter: url'
                code: INVALID_URL
                documentationUrl: https://www.importly.io/docs/errors/invalid-url
            singleItem:
              summary: A single video's link
              value:
                success: false
                error: >-
                  This link is a single item, not a collection. Send it to
                  /import, /metadata or /transcribe.
                code: NOT_A_COLLECTION
                documentationUrl: https://www.importly.io/docs/errors/invalid-url
            mix:
              summary: A YouTube mix
              value:
                success: false
                error: >-
                  YouTube mixes can't be listed: a mix is made for each viewer
                  and changes on every visit. Send a playlist, channel or album
                  link instead.
                code: COLLECTION_NOT_SUPPORTED
                documentationUrl: https://www.importly.io/docs/errors/invalid-url
            invalidCursor:
              summary: A cursor from another collection, or changed
              value:
                success: false
                error: >-
                  Invalid cursor: send the nextCursor from a result for this
                  same collection link, unchanged.
                code: INVALID_CURSOR
                documentationUrl: https://www.importly.io/docs/errors/invalid-request
            invalidLimit:
              summary: limit out of range
              value:
                success: false
                error: limit must be a whole number from 1 to 200
                code: INVALID_REQUEST
                documentationUrl: https://www.importly.io/docs/errors/invalid-request
    Unauthorized:
      description: The API key is missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            missingHeader:
              summary: No Authorization header
              value:
                success: false
                error: >-
                  Missing or invalid Authorization header. Must be in format:
                  Bearer YOUR_API_KEY
                code: UNAUTHORIZED
                documentationUrl: https://www.importly.io/docs/errors/unauthorized
            invalidKey:
              summary: Unknown key
              value:
                success: false
                error: Invalid API key
                code: UNAUTHORIZED
                documentationUrl: https://www.importly.io/docs/errors/unauthorized
    PaymentRequired:
      description: >-
        Your balance is below what the job needs to start ($0.01 for an import
        or a transcription that can run speech-to-text, $0.003 for metadata or a
        transcription with `mode` `captions`). Money your imports still running
        hold counts as available, since they give back what they don't use; the
        job then waits for them. Add credits on the Billing page.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InsufficientBalanceError'
          example:
            success: false
            error: Insufficient balance. Please add credits to your account.
            code: INSUFFICIENT_BALANCE
            endpoint: /import
            balanceRequired: 0.01
            documentationUrl: https://www.importly.io/docs/errors/insufficient-credits
    UnsupportedMediaType:
      description: 'The body isn''t JSON. Send it with `Content-Type: application/json`.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            error: >-
              Request body must be JSON. Send it with Content-Type:
              application/json (got text/plain).
            code: INVALID_REQUEST
            documentationUrl: https://www.importly.io/docs/errors/invalid-request
    TooManyRequests:
      description: >-
        You hit the hourly rate limit for this endpoint, or have too many jobs
        queued or running (`outstanding` and `outstandingLimit` are set). Wait
        `retryAfter` seconds and retry.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        X-RateLimit-Window:
          $ref: '#/components/headers/X-RateLimit-Window'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitError'
          example:
            success: false
            error: 'Rate limit exceeded. Limit: 240 requests per 1 h'
            code: RATE_LIMITED
            limit: 240
            remaining: 0
            reset: 1763200000000
            retryAfter: 1800
            endpoint: /import
            documentationUrl: https://www.importly.io/docs/errors/rate-limited
    InternalError:
      description: Unexpected server error. Retry with exponential backoff.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            error: Internal server error
            code: INTERNAL_ERROR
            documentationUrl: https://www.importly.io/docs/errors/server-error
            requestId: req_3f9a1c7e2b8d4a60
  headers:
    X-RateLimit-Limit:
      description: Requests allowed in the current window.
      schema:
        type: integer
    X-RateLimit-Remaining:
      description: Requests left in the current window.
      schema:
        type: integer
    X-RateLimit-Reset:
      description: When the window resets, as Unix time in milliseconds.
      schema:
        type: integer
    X-RateLimit-Window:
      description: Window length, e.g. `1 h`.
      schema:
        type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your API key from the dashboard, sent as `Authorization: Bearer <api
        key>`.

````

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