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

# Attaching Tags

## Attaching Tags

Tags can be attached to any *taggable* -- `leads`, `sender emails`, and `campaigns`.

<Tabs>
  <Tab title="API" icon="binary">
    Send a `POST` request to one of the [following endpoints](https://dedi.emailbison.com/api/reference#tag/custom-tags).

    ```bash theme={null}
    /api/tags/attach-to-sender-emails
    ```

    ```bash theme={null}
    /api/tags/attach-to-leads
    ```

    ```bash theme={null}
    /api/tags/attach-to-campaigns
    ```

    The fields for these endpoints are:

    <ParamField path="tag_ids" type="array" required>
      An array of tag IDs to attach
    </ParamField>

    <ParamField path="{taggable}_ids" type="array" required>
      An array of taggables to attach the tags to.
      One of `sender_email_ids`, `lead_ids`, `campaign_ids`.
    </ParamField>

    An example of a request to attach tags with IDs 1 and 2 to sender emails with IDs 3 and 4:

    <CodeGroup>
      ```bash curl {6,7} theme={null}
      curl https://dedi.emailbison.com/api/tags/attach-to-sender-emails \
        --request POST \
        --header 'Content-Type: application/json' \
        --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
        --data '{
        "tag_ids": [1, 2],
        "sender_email_ids": [3, 4]
      }'
      ```

      ```JavaScript JavaScript {8,9} theme={null}
      fetch('https://dedi.emailbison.com/api/tags/attach-to-sender-emails', {
        method: 'POST',
        headers: {
      	'Content-Type': 'application/json',
      	Authorization: 'Bearer YOUR_SECRET_TOKEN'
        },
        body: JSON.stringify({
      	tag_ids: [1, 2],
      	sender_email_ids: [3, 4]
        })
      })
      ```

      ```Python Python {7,8} theme={null}
      headers = {
      	'Content-Type': 'application/json',
      	'Authorization': 'Bearer YOUR_SECRET_TOKEN',
      }

      json_data = {
      	'tag_ids': [1, 2],
      	'sender_email_ids': [3, 4]
      }

      response = requests.post('https://dedi.emailbison.com/api/tags/attach-to-sender-emails', headers=headers, json=json_data)
      ```
    </CodeGroup>
  </Tab>

  <Tab title="UI" icon="browser">
    1. Navigate to the `Campaigns`, `Email Accounts`, or `Contacts` tab.
    2. Filter and select taggables by clicking on the checkboxes on the left hand side.
    3. After selecting, a `Add tags` button will appear.
    4. Select tags from the dropdown, and click `Attach tags`.
  </Tab>
</Tabs>
