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

# Attach Tags

> Attach one or more tags to sources, transformations, destinations, and other catalog resources.

The attach endpoint associates one or more tags with a set of resources. It accepts a list of tag `names` — any name that does not yet exist in your organization is created on the fly, and any name that already exists is reused. Every resource list in the request body is then attached to every tag in `names`.

This makes it possible to tag a single resource, apply several tags to a single resource, or apply tags to many resources in a single call.

<Warning>
  The interactive API Playground on this page is generated from the OpenAPI schema and may only show the base `Tag` fields. The canonical request body is the one documented below (`names` plus the per-resource ID arrays), and the response is an **array** of tags, not a single object.
</Warning>

## Request body

| Parameter         | Type             | Required | Description                                                           |
| ----------------- | ---------------- | -------- | --------------------------------------------------------------------- |
| `names`           | array of strings | Yes      | Tag names to attach. Tags that don't exist are created automatically. |
| `sources`         | array of UUIDs   | No       | Source IDs to tag.                                                    |
| `transformations` | array of UUIDs   | No       | Transformation IDs to tag (covers queries, notebooks, and histories). |
| `destinations`    | array of UUIDs   | No       | Destination IDs to tag.                                               |
| `visualizations`  | array of UUIDs   | No       | Visualization IDs to tag.                                             |
| `layers`          | array of UUIDs   | No       | Layer IDs to tag.                                                     |
| `folders`         | array of UUIDs   | No       | Folder IDs to tag.                                                    |
| `tables`          | array of UUIDs   | No       | Table IDs to tag.                                                     |
| `volumes`         | array of UUIDs   | No       | Volume IDs to tag.                                                    |

<Note>
  At least one resource list must contain at least one ID. Tag names provided in `names` but missing from the organization are created before the attachment happens.
</Note>

## Response

The endpoint returns the full list of tags that were attached — both the ones that already existed and the ones that were created during the call.

```json theme={null}
[
  {
    "id": "6f2a9c4b-2a10-4e7f-9c54-d2a9b1d28b0e",
    "name": "marketing",
    "created_at": "2026-04-17T10:15:00.000000-03:00",
    "updated_at": "2026-04-17T10:15:00.000000-03:00"
  }
]
```

## Example: attach one tag to a single source

Use this pattern when you want to label an individual resource, for example marking a single Facebook Ads source as part of your marketing stack.

```bash theme={null}
curl --request POST \
  --url https://api.nekt.ai/api/v1/tags/attach/ \
  --header "x-api-key: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "names": ["marketing"],
    "sources": ["d2c1b472-902c-477a-b300-e7c3fd72609b"]
  }'
```

## Example: attach multiple tags to one transformation

Multiple names in a single request attach every tag to every listed resource. Tags that do not yet exist are created before the attachment.

```bash theme={null}
curl --request POST \
  --url https://api.nekt.ai/api/v1/tags/attach/ \
  --header "x-api-key: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "names": ["marketing", "weekly-refresh", "owned-by-revops"],
    "transformations": ["a7b4f0d2-5c91-4e34-9c1f-7e3a5f1c9d02"]
  }'
```

## Example: batch attach tags across sources, transformations, and destinations

A single request can target every resource type at once. Every tag in `names` is attached to every ID listed in the resource arrays.

```bash theme={null}
curl --request POST \
  --url https://api.nekt.ai/api/v1/tags/attach/ \
  --header "x-api-key: YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "names": ["marketing", "production"],
    "sources": [
      "d2c1b472-902c-477a-b300-e7c3fd72609b",
      "f3e4d5c6-b7a8-49e0-1f2a-3b4c5d6e7f80"
    ],
    "transformations": [
      "a7b4f0d2-5c91-4e34-9c1f-7e3a5f1c9d02",
      "b8c5e1e3-6d02-4f45-ad20-8f4b6e2d0e13"
    ],
    "destinations": [
      "e4d5c6b7-a8b9-40c1-d2e3-f4a5b6c7d8e9"
    ]
  }'
```

## Python example: tag every source that matches a pattern

The snippet below lists all sources, filters them by slug prefix, and attaches a tag to the whole batch in a single call.

```python theme={null}
import requests

API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.nekt.ai"

headers = {
    "x-api-key": API_KEY,
    "Content-Type": "application/json",
}

sources = requests.get(f"{BASE_URL}/api/v1/sources/", headers=headers).json()
ads_source_ids = [s["id"] for s in sources["results"] if s["slug"].endswith("-ads")]

requests.post(
    f"{BASE_URL}/api/v1/tags/attach/",
    headers=headers,
    json={
        "names": ["ads"],
        "sources": ads_source_ids,
    },
)
```

## Related

* [Detach Tags](/platform-api/tags/detach) — remove tags from the same resource types.
* [List Tags](/platform-api/tags/list) — browse existing tags in your organization.


## OpenAPI

````yaml POST /api/v1/tags/attach/
openapi: 3.0.3
info:
  title: Nekt API
  version: v1
  description: Nekt API Documentation
  contact:
    email: support@nekt.ai
servers:
  - url: https://api.nekt.ai
security: []
paths:
  /api/v1/tags/attach/:
    post:
      tags:
        - v1
      operationId: v1_tags_attach_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Tag'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/Tag'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Tag'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Tag'
          description: ''
      security:
        - ApiKeyAuth: []
components:
  schemas:
    Tag:
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        name:
          type: string
          maxLength: 255
        created_at:
          type: string
          format: date-time
          readOnly: true
        updated_at:
          type: string
          format: date-time
          readOnly: true
      required:
        - created_at
        - id
        - name
        - updated_at
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: 'API Key authentication. Format: ''x-api-key: api_key'''

````