> ## 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.

# Tag Media

> Tags a stored image now and saves the tags on it. Charged per image at your plan's usage rate, unless the same image was tagged before. Tags you set yourself are kept.


Tags one of your stored images now and saves the tags on it. To tag images as
they're uploaded instead, pass `autoTag=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/tags" \
  -H "Authorization: Bearer drp_live_xxxxx"
```

```json theme={null}
{
  "tags": [
    { "name": "summer sale", "confidence": null, "source": "manual" },
    { "name": "sneaker", "confidence": 98.2, "source": "ai" }
  ],
  "tagStatus": "done",
  "cached": false
}
```

Running it again replaces Dreep's tags. Tags you set with
[Set Media Tags](https://docs.dreep.cloud/api-reference/image-tags/set-media-tags.md) are kept, and win
when both have the same name.


## OpenAPI

````yaml POST /api/v1/media/{mediaId}/tags
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}/tags:
    post:
      tags:
        - Image Tags
      summary: Tag Media
      description: >
        Tags a stored image now and saves the tags on it. Charged per image at
        your plan's usage rate, unless the same image was tagged before. Tags
        you set yourself are kept.
      parameters:
        - name: mediaId
          in: path
          required: true
          description: The image's ID.
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: The image's tags after tagging
          content:
            application/json:
              schema:
                type: object
                properties:
                  tagStatus:
                    $ref: '#/components/schemas/TagStatus'
                  tags:
                    type: array
                    items:
                      $ref: '#/components/schemas/SavedTag'
                  cached:
                    type: boolean
                    description: >-
                      True when the same image was tagged before; you weren't
                      charged.
        '400':
          description: Not an image in this project, or its upload hasn't finished.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          description: >
            The account has no credit left for tagging. The body carries `code:
            "LIMIT_EXCEEDED"` and `featureKey: "image_taggings"`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Tagging failed. Nothing was charged; try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    TagStatus:
      type: string
      nullable: true
      enum:
        - pending
        - done
        - failed
        - skipped
      description: >
        Where tagging has got to. `skipped` means the account had no credit left
        for tagging. Null when tagging was never asked for.
    SavedTag:
      type: object
      properties:
        name:
          type: string
          example: sneaker
        confidence:
          type: number
          nullable: true
          description: From 0 to 100. Null for tags you set yourself.
          example: 98.2
        source:
          type: string
          enum:
            - ai
            - manual
          description: '`ai` when Dreep added it, `manual` when you did.'
    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.