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

# Update Prompt Tags

> Bulk-updates tags across one or more of a project's prompts. Each entry targets a prompt by UUID and either replaces its tags wholesale (`sync`) or applies incremental changes (`add` / `remove`). `sync` cannot be combined with `add`/`remove`, and each entry must specify at least one of the three. Tags are referenced by UUID and must already exist on the project; use `/api/v1/projects/{project}/tags` to create or list them. The whole request is applied atomically.



## OpenAPI

````yaml /openapi.json patch /api/v1/projects/{project}/prompts/tags
openapi: 3.1.0
info:
  title: Surfacd Public API
  version: 1.0.0
  description: >-
    Public API for Surfacd. Team-scoped operations live under
    `/api/v1/team/...`; project collections live under `/api/v1/projects`;
    project-scoped operations live under `/api/v1/projects/{project}/...`. All
    endpoints require a Bearer team API key created in Team Settings. The API
    key selects the team for team-level and collection endpoints.
servers:
  - url: https://app.surfacd.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Projects
    description: Project management endpoints. Reads only in this version.
  - name: Prompts
    description: Prompt management endpoints. Reads only in this version.
  - name: Team
    description: Team settings and plan details for the current team.
  - name: Reporting
    description: >-
      Read-only reporting endpoints for projects (brand rankings, mentions,
      visibility, matrix analysis, source data).
  - name: Reference
    description: Reference data used by create, update, and reporting filters.
  - name: Tags
    description: Project tag management endpoints.
paths:
  /api/v1/projects/{project}/prompts/tags:
    parameters:
      - $ref: '#/components/parameters/ProjectUuid'
    patch:
      tags:
        - Prompts
      summary: Update Prompt Tags
      description: >-
        Bulk-updates tags across one or more of a project's prompts. Each entry
        targets a prompt by UUID and either replaces its tags wholesale (`sync`)
        or applies incremental changes (`add` / `remove`). `sync` cannot be
        combined with `add`/`remove`, and each entry must specify at least one
        of the three. Tags are referenced by UUID and must already exist on the
        project; use `/api/v1/projects/{project}/tags` to create or list them.
        The whole request is applied atomically.
      operationId: v1ProjectsPromptsUpdateTags
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePromptTagsRequest'
      responses:
        '200':
          description: The affected prompts with their resulting tags.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdatePromptTagsResult'
        '404':
          description: Project not found in the current team.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  parameters:
    ProjectUuid:
      name: project
      in: path
      required: true
      description: Project UUID.
      schema:
        type: string
        format: uuid
  schemas:
    UpdatePromptTagsRequest:
      type: object
      properties:
        prompts:
          type: array
          minItems: 1
          maxItems: 100
          items:
            $ref: '#/components/schemas/UpdatePromptTagsInput'
      required:
        - prompts
    UpdatePromptTagsResult:
      type: object
      properties:
        prompts:
          type: array
          items:
            $ref: '#/components/schemas/Prompt'
          description: The affected prompts with their resulting tag sets.
      required:
        - prompts
    UpdatePromptTagsInput:
      type: object
      description: >-
        A single prompt's tag changes. Provide `sync` on its own, or
        `add`/`remove` together. Tags are referenced by UUID.
      properties:
        prompt:
          type: string
          format: uuid
          description: UUID of the prompt to update.
        sync:
          type: array
          items:
            type: string
            format: uuid
          description: >-
            Replace the prompt's tags with exactly these tag UUIDs. An empty
            array clears all tags. Cannot be combined with add/remove.
        add:
          type: array
          items:
            type: string
            format: uuid
          description: Tag UUIDs to add, leaving existing tags in place.
        remove:
          type: array
          items:
            type: string
            format: uuid
          description: Tag UUIDs to remove. Unknown or inaccessible tag UUIDs are rejected.
      required:
        - prompt
    Prompt:
      type: object
      properties:
        uuid:
          type: string
          format: uuid
        text:
          type: string
          description: The prompt text.
        keyword:
          type:
            - string
            - 'null'
        status:
          $ref: '#/components/schemas/PromptStatus'
        search_volume:
          type:
            - integer
            - 'null'
          description: Most recent search volume for the prompt's keyword, when known.
        topic:
          oneOf:
            - $ref: '#/components/schemas/PromptTopic'
            - type: 'null'
        country:
          $ref: '#/components/schemas/ProjectCountry'
        tags:
          type: array
          items:
            $ref: '#/components/schemas/PromptTag'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - uuid
        - text
        - keyword
        - status
        - search_volume
        - topic
        - country
        - tags
        - created_at
        - updated_at
    ValidationError:
      type: object
      description: Returned when one or more request parameters fail validation.
      properties:
        message:
          type: string
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
      required:
        - message
        - errors
    PromptStatus:
      type: string
      enum:
        - suggestion
        - declined
        - inactive
        - active
    PromptTopic:
      type: object
      properties:
        uuid:
          type: string
          format: uuid
        name:
          type: string
      required:
        - uuid
        - name
    ProjectCountry:
      type: object
      properties:
        code:
          type: string
          description: ISO 3166-1 alpha-2 country code (lowercase).
        name:
          type: string
      required:
        - code
        - name
    PromptTag:
      type: object
      properties:
        uuid:
          type: string
          format: uuid
        name:
          type: string
        color:
          type:
            - string
            - 'null'
      required:
        - uuid
        - name
        - color
  responses:
    ValidationError:
      description: Validation failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: token
      description: >-
        Team API key created in Team Settings. Use it with URLs for the same
        team.

````