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

# Index Media

> Indexes a stored image for similar-image and text search. Charged per image at your plan's usage rate, unless the same image was indexed before.


Indexes one of your stored images so it can be found by
[Find Similar Media](https://docs.dreep.cloud/api-reference/image-search/find-similar-media.md) and
[Search Media](https://docs.dreep.cloud/api-reference/image-search/search-media.md). To index images as
they're uploaded instead, pass `autoIndex=true` to
[Upload Media](https://docs.dreep.cloud/api-reference/upload/upload-media.md).

```bash theme={null}
curl -X POST "https://api.dreep.cloud/api/v1/media/2f928a3f-1d2a-4a2b/index" \
  -H "Authorization: Bearer drp_live_xxxxx"
```

```json theme={null}
{
  "indexStatus": "done",
  "cached": false
}
```

Indexing the same image again is free and returns `"cached": true`.


## OpenAPI

````yaml POST /api/v1/media/{mediaId}/index
openapi: 3.0.0
info:
  title: Dreep API
  description: The universal media processing and storage API.
  version: 1.0.0
servers:
  - url: https://api.dreep.cloud
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /api/v1/media/{mediaId}/index:
    post:
      tags:
        - Image Search
      summary: Index Media
      description: >
        Indexes a stored image for similar-image and text search. Charged per
        image at your plan's usage rate, unless the same image was indexed
        before.
      parameters:
        - name: mediaId
          in: path
          required: true
          description: The image's ID.
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: The image is indexed
          content:
            application/json:
              schema:
                type: object
                properties:
                  indexStatus:
                    $ref: '#/components/schemas/IndexStatus'
                  cached:
                    type: boolean
                    description: >-
                      True when the same image was indexed before; you weren't
                      charged.
        '400':
          description: >-
            Not an image in this project, its upload hasn't finished, or it
            isn't a readable image.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          description: >
            The account has no credit left for indexing. The body carries `code:
            "LIMIT_EXCEEDED"` and `featureKey: "image_indexings"`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Indexing failed. Nothing was charged; try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: Image search isn't available right now.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    IndexStatus:
      type: string
      nullable: true
      enum:
        - pending
        - done
        - failed
        - skipped
      description: >
        Where search indexing has got to. `skipped` means the account had no
        credit left for indexing. Null when indexing was never asked for.
    Error:
      type: object
      properties:
        error:
          type: boolean
          example: true
        message:
          type: string
          example: Invalid request parameters
        code:
          type: string
          example: invalid_request
  responses:
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer

````

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