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

# Assign Tags to Email Accounts

> Add tags to one or more email accounts

<Note>
  Assign existing tags to email accounts for better organization. You can tag up to 25 email accounts at once.
</Note>

## Query Parameters

<ParamField query="api_key" type="string" required>
  Your SmartLead API key
</ParamField>

## Request Body

<ParamField body="email_account_ids" type="array" required>
  Array of email account IDs to tag. Minimum 1, maximum 25 accounts.
</ParamField>

<ParamField body="tag_ids" type="array" required>
  Array of tag IDs to assign. Minimum 1 tag required.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://server.smartlead.ai/api/v1/email-accounts/tag-mapping?api_key=YOUR_KEY" \
    -H "Content-Type: application/json" \
    -d '{"email_account_ids": [101, 102, 103], "tag_ids": [1, 2]}'
  ```
</RequestExample>

## Response Codes

<ResponseField name="200" type="Success">
  Request successful
</ResponseField>

<ResponseField name="400" type="Bad Request">
  Invalid request parameters or malformed request body
</ResponseField>

<ResponseField name="401" type="Unauthorized">
  Invalid or missing API key
</ResponseField>

<ResponseField name="422" type="Validation Error">
  Request validation failed. Check parameter types and constraints.
</ResponseField>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "ok": true,
    "message": "Tags assigned successfully"
  }
  ```

  ```json 401 - Unauthorized theme={null}
  {
    "message": "Invalid API Key"
  }
  ```
</ResponseExample>
