PageHub Stock API

Public stock image and video search.

GitHub OpenAPI

Operations 4

GET /api/v1/stock-images Search stock images #
POST /api/v1/stock-images Upsert stock images (admin) #
POST /api/v1/stock-images/search-external Search a stock image provider #
POST /api/v1/stock-videos/search-external Search a stock video provider #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/pagehub-dev:pagehub-dev-stock-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

pagehub-dev-stock-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: PageHub Stock API
  version: 1.0.0
  description: 'The public REST API of PageHub, called with a `ph_` API key (`Authorization: Bearer ph_...`), plus the one webhook the platform calls on a white-label tenant''s server (`fetchPage`).


    A site is HTML + Liquid files: its pages are files (`pages/*.liquid`), written through the files API; the page routes manage each page''s record (name, slug, SEO, access). Writes land in the site''s draft; `PUT /api/v1/sites/{id}` with `published: true` makes the draft live.


    The headless content API (`/api/v1/content/...`) is described by its own document (`GET /api/v1/content/openapi.json`); `GET /api/openapi.json` serves this document with it merged in.


    The routes also accept the dashboard''s session cookie from the dashboard itself; only the API key is the public contract.


    Every operation carries two extension fields. `x-auth` says who may call it: `api-key` (a `ph_` key), `session-or-key` (the dashboard''s own session, or a key), `optional-key` (public, a key widens what you see), `admin-key` (a platform admin''s key), `session` (the dashboard session only; an API key is refused) or `public`. `x-rate-limit` names the rate-limit rule (see the rate-limiting guide) when the route has one; most routes limit per user, public routes per IP.'
  contact:
    name: PageHub
    url: https://pagehub.dev/developers
servers:
- url: https://pagehub.dev
  description: PageHub
security:
- bearerAuth: []
tags:
- name: Stock
  description: Public stock image and video search.
paths:
  /api/v1/stock-images:
    get:
      tags:
      - Stock
      summary: Search stock images
      description: Public. Searches the verified stock library; returned images get their `uses` count bumped.
      operationId: searchStockImages
      parameters:
      - name: q
        in: query
        required: false
        schema:
          type: string
        description: Full-text search.
      - name: category
        in: query
        required: false
        schema:
          type: string
      - name: orientation
        in: query
        required: false
        schema:
          type: string
      - name: source
        in: query
        required: false
        schema:
          type: string
          enum:
          - unsplash
          - pexels
          - custom
      - name: sort
        in: query
        required: false
        schema:
          type: string
          enum:
          - popular
          - newest
          default: popular
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
          maximum: 500
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          maximum: 20
          default: 10
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  images:
                    type: array
                    items:
                      $ref: '#/components/schemas/StockImage'
                  total:
                    type: integer
                  page:
                    type: integer
                  pages:
                    type: integer
                required:
                - images
                - total
                - page
                - pages
        '429':
          $ref: '#/components/responses/RateLimited'
      x-auth: public
      x-rate-limit: stock_search
      security: []
    post:
      tags:
      - Stock
      summary: Upsert stock images (admin)
      description: Platform admins only. Each item needs `photoId` and `url`; an item without them comes back as a result with an `error` instead of failing the call.
      operationId: upsertStockImages
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
              - $ref: '#/components/schemas/StockImage'
              - type: array
                items:
                  $ref: '#/components/schemas/StockImage'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  images:
                    type: array
                    items:
                      type: object
                      additionalProperties: true
                  count:
                    type: integer
                required:
                - images
                - count
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      x-auth: admin-key
  /api/v1/stock-images/search-external:
    post:
      tags:
      - Stock
      summary: Search a stock image provider
      description: Public. Searches an external provider (Pexels by default) and caches the results in the stock library. A provider that is unavailable or fails answers 200 with an empty list and a `note`.
      operationId: searchExternalStockImages
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                q:
                  type: string
                count:
                  type: integer
                  minimum: 1
                  maximum: 10
                  default: 5
                orientation:
                  type: string
                provider:
                  type: string
                  default: pexels
              required:
              - q
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  images:
                    type: array
                    items:
                      $ref: '#/components/schemas/StockImage'
                  total:
                    type: integer
                  note:
                    type: string
                required:
                - images
        '400':
          $ref: '#/components/responses/BadRequest'
        '429':
          $ref: '#/components/responses/RateLimited'
      x-auth: public
      x-rate-limit: stock_search_external
      security: []
  /api/v1/stock-videos/search-external:
    post:
      tags:
      - Stock
      summary: Search a stock video provider
      description: Public. Like the image search; nothing is cached.
      operationId: searchExternalStockVideos
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                q:
                  type: string
                count:
                  type: integer
                  minimum: 1
                  maximum: 10
                  default: 5
                orientation:
                  type: string
                minDuration:
                  type: number
                maxDuration:
                  type: number
                provider:
                  type: string
                  default: pexels
              required:
              - q
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  videos:
                    type: array
                    items:
                      $ref: '#/components/schemas/StockVideo'
                  total:
                    type: integer
                  note:
                    type: string
                required:
                - videos
        '400':
          $ref: '#/components/responses/BadRequest'
        '429':
          $ref: '#/components/responses/RateLimited'
      x-auth: public
      x-rate-limit: stock_search_external
      security: []
components:
  responses:
    Unauthorized:
      description: Missing, malformed or invalid `ph_` API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    BadRequest:
      description: The request is malformed or refused (`error`, often `message`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Forbidden:
      description: The key's user lacks the role this needs, or a plan limit applies.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    RateLimited:
      description: Too many requests.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  schemas:
    StockImage:
      type: object
      description: A stock photo record.
      additionalProperties: true
      properties:
        photoId:
          type: string
        url:
          type: string
        category:
          type: string
        orientation:
          type: string
        source:
          type: string
        tags:
          type: array
          items:
            type: string
        uses:
          type: integer
        verified:
          type: boolean
    StockVideo:
      type: object
      description: A stock video from a provider.
      additionalProperties: true
    ApiError:
      type: object
      description: The error body of the management routes. The content API uses `Error` instead.
      properties:
        error:
          type: string
          description: A message, or a code such as `version_conflict`, `lint`, `maintenance`, `site_format_changed`.
        message:
          type: string
        code:
          type: string
        upgrade:
          type: boolean
          description: True when the plan is the reason.
      required:
      - error
      additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: A `ph_` API key (a user's key, or a tenant's).
    tenantAuthToken:
      type: apiKey
      in: header
      name: x-pagehub-auth
      description: The tenant's token, sent by PageHub on every webhook call so the tenant can check the request came from PageHub.