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

# Search YouTube

> Search YouTube videos and channels.

Each request fetches one page. Pass `next_cursor` back as `cursor` to fetch and bill the next page.

**Availability:** When live data is temporarily unavailable this endpoint returns `503` with `error.code: service_unavailable` in the standard error envelope. Honor `Retry-After` when present and retry with bounded backoff; you are not charged for `503` responses.

**Pricing**: 0.5 credits per fetched page ($0.005)



## OpenAPI

````yaml /openapi/openapi.documented.yml get /v1/raw/youtube/search
openapi: 3.1.0
info:
  title: Influship API
  version: 1.0.0
  description: >
    Public API for creator search, profile lookup, and campaign-fit analysis.


    ## Authentication


    Send your API key in the `X-API-Key` header on every authenticated request.


    ```bash

    curl -H "X-API-Key: your_api_key"
    https://api.influship.com/v1/creators/autocomplete?q=fitness

    ```


    ## Billing and Rate Limits


    The API uses credit-based billing and credit-based rate limits.


    - every endpoint has a credit cost

    - successful responses include `X-Credits-Charged` and `X-Credits-Features`

    - rate limits are enforced with per-minute and per-hour credit budgets

    - rate limit state is returned in the `RateLimit-*` headers


    ## Agentic Payments


    Use `https://api.influship.com/openapi.json` to discover endpoints that
    accept x402 v2 or MPP payments without an API key. It includes `402` payment
    challenges and `x-payment-info` metadata for the available payment methods.


    ## Pagination


    List endpoints use cursor pagination.


    - send `limit` to control page size

    - use `next_cursor` from the response to fetch the next page

    - stop when `has_more` is `false`


    Search has one special rule:


    - `POST /v1/search` creates a persisted search session

    - `GET /v1/search/{id}` paginates that session for free

    - free pagination is capped by the original search `limit`


    ## Errors


    Errors use a consistent shape:


    ```json

    {
      "error": {
        "code": "rate_limit_exceeded",
        "message": "Rate limit exceeded (per minute)"
      }
    }

    ```


    See each operation for exact request and response schemas.
  contact:
    name: Influship Support
    email: support@influship.com
  license:
    name: Proprietary
    url: https://influship.com/terms
servers:
  - url: https://api.influship.com
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Shortlists
    description: Private creator shortlists saved to your API account or OAuth user.
  - name: Health
    description: API health and status endpoints
  - name: Creators
    description: >-
      Retrieve creator profiles and discover new creators through search,
      autocomplete, and lookalike matching. Creators are cross-platform entities
      that may have profiles on multiple social networks.
  - name: Profiles
    description: >-
      Access individual social media profiles with detailed metrics, growth
      data, and activity information. Profiles are platform-specific accounts
      linked to creators.
  - name: Creator Emails
    description: >-
      Look up known creator email addresses by creator ID or social username.
      Empty or unresolved results are not billable.
  - name: Posts
    description: >-
      Retrieve and analyze social media posts with engagement metrics, media
      content, and performance data.
  - name: Search
    description: >-
      AI-powered semantic search to find creators using natural language
      queries. Understands intent and context to match creators based on content
      themes, audience, and style.
  - name: Live Scraping
    description: >-
      Research Instagram, TikTok, and YouTube profiles, content, metrics, and
      transcripts with live platform endpoints.
paths:
  /v1/raw/youtube/search:
    get:
      tags:
        - Live Scraping
      summary: Search YouTube
      description: >-
        Search YouTube videos and channels.


        Each request fetches one page. Pass `next_cursor` back as `cursor` to
        fetch and bill the next page.


        **Availability:** When live data is temporarily unavailable this
        endpoint returns `503` with `error.code: service_unavailable` in the
        standard error envelope. Honor `Retry-After` when present and retry with
        bounded backoff; you are not charged for `503` responses.


        **Pricing**: 0.5 credits per fetched page ($0.005)
      operationId: searchYouTube
      parameters:
        - schema:
            type: string
            minLength: 1
            maxLength: 500
            description: Search query
            example: fitness workout
          in: query
          name: q
          required: true
          description: Search query
        - schema:
            default: 20
            description: Maximum number of results to return
            example: 20
            type: integer
            minimum: 1
            maximum: 50
          in: query
          name: limit
          description: Maximum number of results to return
        - schema:
            default: US
            description: Country code for localized results (ISO 3166-1 alpha-2)
            example: US
            type: string
            minLength: 2
            maxLength: 2
          in: query
          name: country_code
          description: Country code for localized results (ISO 3166-1 alpha-2)
        - schema:
            default: en
            description: Language code for results
            example: en
            type: string
            minLength: 2
            maxLength: 5
          in: query
          name: language_code
          description: Language code for results
        - schema:
            default: any
            description: Only return results uploaded within the selected window
            example: this_week
            type: string
            enum:
              - any
              - last_hour
              - today
              - this_week
              - this_month
              - this_year
          in: query
          name: upload_date
          description: Only return results uploaded within the selected window
        - schema:
            default: relevance
            description: Order results by relevance or view popularity
            example: popular
            type: string
            enum:
              - relevance
              - popular
          in: query
          name: sort_by
          description: Order results by relevance or view popularity
        - schema:
            default: all
            description: Return all result types or only videos
            example: videos
            type: string
            enum:
              - all
              - videos
          in: query
          name: content_type
          description: Return all result types or only videos
        - schema:
            default: any
            description: Filter videos by YouTube duration band
            example: long
            type: string
            enum:
              - any
              - short
              - medium
              - long
          in: query
          name: duration
          description: Filter videos by YouTube duration band
        - schema:
            description: Opaque cursor from next_cursor to fetch the next result page
            type: string
            minLength: 1
            maxLength: 4000
          in: query
          name: cursor
          description: Opaque cursor from next_cursor to fetch the next result page
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YouTubeSearchResponse'
        '400':
          description: Validation error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400'
        '401':
          description: Authentication error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error401'
        '402':
          description: >-
            Account billing requires attention, or available credits cannot
            cover this request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiCreditError402'
        '403':
          description: Permission error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error403'
        '429':
          description: >-
            Rate limit exceeded response. Check Retry-After header for backoff
            timing. Also returned (without RateLimit-* headers) when an IP is
            temporarily blocked after repeated failed authentication attempts.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error429'
        '500':
          description: Internal server error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error500'
        '502':
          description: >-
            The upstream source answered, but with data this endpoint cannot
            process — for example a response schema the source has retired.
            Unlike 503 this is deterministic: the same request will keep failing
            until a fix ships, so it never carries Retry-After and retrying only
            burns credits. These are alerted on automatically.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error502'
        '503':
          description: >-
            Service temporarily unavailable. Check Retry-After when present and
            retry with bounded backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error503'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Influship from 'influship';


            const client = new Influship({
              apiKey: process.env['INFLUSHIP_API_KEY'], // This is the default and can be omitted
            });


            const response = await client.raw.youtube.search({ q: 'fitness
            workout' });


            console.log(response.data);
components:
  schemas:
    YouTubeSearchResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/YouTubeSearchResponseData'
      required:
        - data
      additionalProperties: false
    Error400:
      $ref: '#/components/schemas/Error'
      description: Validation error response
      examples:
        - error:
            code: validation_error
            message: 'Invalid value for parameter ''limit'': must be between 1 and 100'
            param: limit
            request_id: 550e8400-e29b-41d4-a716-446655440000
    Error401:
      $ref: '#/components/schemas/Error'
      description: Authentication error response
      examples:
        - error:
            code: unauthorized
            message: API key missing or invalid
            request_id: 550e8400-e29b-41d4-a716-446655440000
    ApiCreditError402:
      anyOf:
        - $ref: '#/components/schemas/Error402'
        - $ref: '#/components/schemas/ErrorInsufficientCredits'
      description: >-
        Account billing requires attention, or available credits cannot cover
        this request.
    Error403:
      $ref: '#/components/schemas/Error'
      description: Permission error response
      examples:
        - error:
            code: forbidden
            message: Your plan does not include access to this endpoint
            request_id: 550e8400-e29b-41d4-a716-446655440000
    Error429:
      $ref: '#/components/schemas/Error'
      description: >-
        Rate limit exceeded response. Check Retry-After header for backoff
        timing. Also returned (without RateLimit-* headers) when an IP is
        temporarily blocked after repeated failed authentication attempts.
      examples:
        - error:
            code: rate_limit_exceeded
            message: Rate limit exceeded (per minute)
            request_id: 550e8400-e29b-41d4-a716-446655440000
        - error:
            code: rate_limit_exceeded
            message: Rate limit exceeded (per hour)
            request_id: 550e8400-e29b-41d4-a716-446655440001
        - error:
            code: rate_limit_exceeded
            message: Too many failed authentication attempts. Please try again later.
            request_id: 550e8400-e29b-41d4-a716-446655440002
    Error500:
      $ref: '#/components/schemas/Error'
      description: Internal server error response
      examples:
        - error:
            code: internal_error
            message: An unexpected error occurred. Please try again later.
            request_id: 550e8400-e29b-41d4-a716-446655440000
    Error502:
      $ref: '#/components/schemas/Error'
      description: >-
        The upstream source answered, but with data this endpoint cannot process
        — for example a response schema the source has retired. Unlike 503 this
        is deterministic: the same request will keep failing until a fix ships,
        so it never carries Retry-After and retrying only burns credits. These
        are alerted on automatically.
      examples:
        - error:
            code: upstream_contract_broken
            message: >-
              The upstream source returned data this endpoint cannot process.
              This is not retryable; it has been reported.
            request_id: 550e8400-e29b-41d4-a716-446655440000
            details:
              upstream_error: upstream_contract_broken
              retryable: false
    Error503:
      $ref: '#/components/schemas/Error'
      description: >-
        Service temporarily unavailable. Check Retry-After when present and
        retry with bounded backoff.
      examples:
        - error:
            code: service_unavailable
            message: >-
              Live Instagram data is temporarily unavailable. Please retry
              shortly.
            request_id: 550e8400-e29b-41d4-a716-446655440000
            details:
              retry_after_seconds: 60
              upstream_error: upstream_rate_limited
    YouTubeSearchResponseData:
      type: object
      properties:
        query:
          type: string
          description: The search query
        estimated_results:
          type:
            - number
            - 'null'
          minimum: 0
          description: Estimated total results count
        results:
          type: array
          items:
            anyOf:
              - $ref: '#/components/schemas/YouTubeSearchVideoResult'
              - $ref: '#/components/schemas/YouTubeSearchChannelResult'
          description: Search results (videos and channels)
        next_cursor:
          type:
            - string
            - 'null'
          description: >-
            Opaque cursor for the next page, or null when no next page is
            available
        scraped_at:
          type: string
          description: When this search was performed
      required:
        - query
        - estimated_results
        - results
        - next_cursor
        - scraped_at
      additionalProperties: false
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              $ref: '#/components/schemas/ErrorCode'
              description: Machine-readable error code
            message:
              type: string
              description: Human-readable error message
              example: Request validation failed
            status_code:
              description: >-
                HTTP status code repeated for clients that consume the error
                body
              example: 402
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            param:
              description: Parameter that caused the error (if applicable)
              example: query
              type: string
            request_id:
              description: >-
                Optional request ID for debugging. Read the X-Request-Id
                response header when absent.
              example: 550e8400-e29b-41d4-a716-446655440000
              type: string
            details:
              description: Structured error context (e.g., field-level validation issues)
              type: object
              propertyNames:
                type: string
              additionalProperties: {}
          required:
            - code
            - message
          additionalProperties: false
      required:
        - error
      additionalProperties: false
    Error402:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              const: payment_required
            message:
              type: string
            status_code:
              type: number
              const: 402
            reason_code:
              type: string
              enum:
                - BILLING_SUSPENDED
                - PAYMENT_FAILED
                - PAYMENT_ACTION_REQUIRED
                - DISPUTE_OPENED
                - NO_PAYMENT_METHOD
                - SUBSCRIPTION_REQUIRED
                - NO_BUNDLE_CONFIGURED
                - BUNDLE_EXHAUSTED
            next_step:
              type: string
              enum:
                - update_payment_method
                - complete_authentication
                - contact_support
                - add_payment_method
                - reconnect_connection
                - upgrade_plan
            request_id:
              type: string
            details:
              type: object
              propertyNames:
                type: string
              additionalProperties: {}
          required:
            - code
            - message
            - status_code
            - reason_code
            - next_step
          additionalProperties: false
      required:
        - error
      additionalProperties: false
      description: >-
        Payment required response. Returned when account billing or a
        subscription bundle requires attention.
      examples:
        - error:
            code: payment_required
            message: Payment authentication is required.
            status_code: 402
            reason_code: PAYMENT_ACTION_REQUIRED
            next_step: complete_authentication
            request_id: 550e8400-e29b-41d4-a716-446655440000
    ErrorInsufficientCredits:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              const: insufficient_credits
            message:
              type: string
            status_code:
              type: number
              const: 402
            request_id:
              type: string
            details:
              type: object
              propertyNames:
                type: string
              additionalProperties: {}
          required:
            - code
            - message
          additionalProperties: false
      required:
        - error
      additionalProperties: false
      description: >-
        Remaining credits cannot cover this request. Add a payment method to
        continue. Do not retry automatically.
      examples:
        - error:
            code: insufficient_credits
            message: >-
              Not enough credits remaining for this search. Add a payment method
              to continue.
            details:
              remaining: 10
              required: 75
              add_payment_method: true
    YouTubeSearchVideoResult:
      type: object
      properties:
        type:
          type: string
          const: video
        video_id:
          type: string
          description: YouTube video ID
          example: dQw4w9WgXcQ
        url:
          type: string
          description: Full YouTube video URL
          example: https://www.youtube.com/watch?v=dQw4w9WgXcQ
        title:
          type: string
          description: Video title
        description:
          type:
            - string
            - 'null'
          description: Video description snippet
        channel_id:
          type: string
          description: Channel ID
        channel_name:
          type: string
          description: Channel name
        channel_handle:
          type:
            - string
            - 'null'
          description: Channel handle (e.g., @username)
        channel_verified:
          type: boolean
          description: Whether channel is verified
        thumbnail_url:
          type:
            - string
            - 'null'
          description: Video thumbnail URL
        duration_seconds:
          type:
            - number
            - 'null'
          minimum: 0
          description: Video duration in seconds
        duration_text:
          type:
            - string
            - 'null'
          description: Video duration text (e.g., "12:34")
        view_count:
          type:
            - number
            - 'null'
          minimum: 0
          description: Number of views
        view_count_text:
          type:
            - string
            - 'null'
          description: View count text (e.g., "1.2M views")
        published_text:
          type:
            - string
            - 'null'
          description: Relative publish time (e.g., "2 days ago")
        published_at:
          type:
            - string
            - 'null'
          description: Approximate publish timestamp
      required:
        - type
        - video_id
        - url
        - title
        - description
        - channel_id
        - channel_name
        - channel_handle
        - channel_verified
        - thumbnail_url
        - duration_seconds
        - duration_text
        - view_count
        - view_count_text
        - published_text
        - published_at
      additionalProperties: false
    YouTubeSearchChannelResult:
      type: object
      properties:
        type:
          type: string
          const: channel
        channel_id:
          type: string
          description: Channel ID
        url:
          type: string
          description: Full YouTube channel URL
          example: https://www.youtube.com/@channelhandle
        channel_name:
          type: string
          description: Channel name
        channel_handle:
          type:
            - string
            - 'null'
          description: Channel handle (e.g., @username)
        channel_verified:
          type: boolean
          description: Whether channel is verified
        description:
          type:
            - string
            - 'null'
          description: Channel description snippet
        thumbnail_url:
          type:
            - string
            - 'null'
          description: Channel avatar URL
        subscriber_count:
          type:
            - number
            - 'null'
          minimum: 0
          description: Subscriber count
        video_count:
          type:
            - integer
            - 'null'
          minimum: 0
          maximum: 9007199254740991
          description: Number of videos on the channel
      required:
        - type
        - channel_id
        - url
        - channel_name
        - channel_handle
        - channel_verified
        - description
        - thumbnail_url
        - subscriber_count
        - video_count
      additionalProperties: false
    ErrorCode:
      type: string
      enum:
        - validation_error
        - invalid_parameter
        - missing_parameter
        - unauthorized
        - forbidden
        - payment_required
        - insufficient_credits
        - not_found
        - rate_limit_exceeded
        - quota_exceeded
        - internal_error
        - service_unavailable
        - upstream_contract_broken
        - database_error
        - seed_not_found
        - invalid_seeds
        - seed_resolution_failed
        - lookalike_failed
        - get_profiles_failed
        - post_analysis_failed
        - match_failed
        - scraping_failed
        - transcript_unavailable
        - transcript_not_available
        - transcription_limit_exceeded
        - transcription_unavailable
      description: Machine-readable error code for programmatic handling
      example: validation_error
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````

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