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

# Apply agent tags

> Atomically apply tag changes to a workflow. Sets and deletes happen in one transaction; same-key collisions resolve set-wins.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/agents/{workflow_permanent_id}/tags
openapi: 3.1.0
info:
  title: Skyvern API
  description: API for Skyvern
  version: 1.0.0
servers:
  - url: https://api.skyvern.com
    x-fern-server-name: Cloud
  - url: https://api-staging.skyvern.com
    x-fern-server-name: Staging
  - url: http://localhost:8000
    x-fern-server-name: Local
security: []
paths:
  /v1/agents/{workflow_permanent_id}/tags:
    post:
      tags:
        - Tags
      summary: Apply agent tags
      description: >-
        Atomically apply tag changes to a workflow. Sets and deletes happen in
        one transaction; same-key collisions resolve set-wins.
      operationId: apply_workflow_tags_v1_workflows__workflow_permanent_id__tags_post
      parameters:
        - name: workflow_permanent_id
          in: path
          required: true
          schema:
            type: string
            description: Workflow permanent ID
            examples:
              - wpid_123
            title: Workflow Permanent Id
          description: Workflow permanent ID
        - name: x-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Skyvern API key for authentication. API key can be found at
              https://app.skyvern.com/settings.
            title: X-Api-Key
          description: >-
            Skyvern API key for authentication. API key can be found at
            https://app.skyvern.com/settings.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TagApplyRequest'
      responses:
        '200':
          description: Successfully applied tag changes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TagsResponse'
        '404':
          description: Workflow not found
        '422':
          description: Invalid tag key or value
components:
  schemas:
    TagApplyRequest:
      properties:
        tags:
          items:
            $ref: '#/components/schemas/TagInput'
          type: array
          title: Tags
          description: Tags to set (overwrite). List of {key?, value} objects.
        tags_to_delete:
          items:
            $ref: '#/components/schemas/TagDeleteInput'
          type: array
          title: Tags To Delete
          description: Tags to soft-delete. List of {key?, value?} targets.
        colors:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Colors
          description: >-
            Optional map of grouped tag key to palette color name for the value
            being set. Keys absent from this map keep their existing color or
            receive a random palette color.
      type: object
      title: TagApplyRequest
      description: >-
        Body for ``POST /v1/workflows/{wpid}/tags``. Either field may be empty
        (both

        empty is a no-op). On a same-identity collision, set wins over delete.
    TagsResponse:
      properties:
        workflow_permanent_id:
          type: string
          title: Workflow Permanent Id
        tags:
          items:
            $ref: '#/components/schemas/TagResponse'
          type: array
          title: Tags
      type: object
      required:
        - workflow_permanent_id
        - tags
      title: TagsResponse
      description: >-
        Current tags for a workflow. A list (not a key-map) so standalone
        labels,

        which have no key, are representable.
    TagInput:
      properties:
        key:
          anyOf:
            - type: string
            - type: 'null'
          title: Key
          description: Optional group (key). Omit for a standalone label.
        value:
          type: string
          title: Value
          description: Label (value). Always required.
      type: object
      required:
        - value
      title: TagInput
      description: >-
        One tag to set. ``value`` is the required label; ``key`` is the optional

        group — null for a standalone label, set for a grouped label (e.g.
        env:prod).
    TagDeleteInput:
      properties:
        key:
          anyOf:
            - type: string
            - type: 'null'
          title: Key
          description: Group (key) to delete. Use for grouped tags.
        value:
          anyOf:
            - type: string
            - type: 'null'
          title: Value
          description: Label (value) to delete. Use for standalone labels.
      type: object
      title: TagDeleteInput
      description: >-
        One tag to soft-delete: a grouped tag by its ``key``, or a standalone
        label

        by its ``value`` (omit the key).
    TagResponse:
      properties:
        key:
          anyOf:
            - type: string
            - type: 'null'
          title: Key
        value:
          type: string
          title: Value
        source:
          type: string
          title: Source
        set_at:
          type: string
          format: date-time
          title: Set At
        set_by:
          type: string
          title: Set By
      type: object
      required:
        - value
        - source
        - set_at
        - set_by
      title: TagResponse
      description: |-
        Current state of one tag (``GET /v1/workflows/{wpid}/tags`` row).
        ``key`` is null for a standalone label.

````