# Update Tag

> `PUT /inboxes/{inbox_id}/tags/{tag_id}`

Web page: https://reference.earthclassmail.com/v1/rest-api/spec/operations/updateinboxtag/

URL: `PUT https://api.earthclassmail.com/v1/inboxes/{inbox_id}/tags/{tag_id}`

Updates an existing tag. This is a full replacement: send every field. Omitting `parent_tag_id` makes the tag a top-level tag.

The label rules of createInboxTag apply.

## Authorization

Send your API key in the `x-api-key` header.

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `inbox_id` | path | yes | string |  |
| `tag_id` | path | yes | string |  |

## Request body

Required.

Content type: `application/json`

Type: `TagInput`

Example:

```json
{
  "label": "Invoices"
}
```

## Responses

### 200

Success

Content type: `application/json`

Type: `Tag`

Example:

```json
{
  "id": 204496,
  "created_at": "2026-06-03T08:35:08Z",
  "updated_at": "2026-06-03T08:35:08Z",
  "label": "test-tag-1"
}
```

### 401

The `x-api-key` header is missing or the key is not valid, or the caller can't access an ID in the request. IDs that don't exist return the same response as IDs the caller can't access.

Content type: `application/json`

Type: `Error`

Example — Missing API key:

```json
{
  "error": {
    "code": 401,
    "message": "The request does not include a valid access token. Please provide a valid access token.",
    "type": "Authorization"
  }
}
```

Example — Invalid API key:

```json
{
  "error": {
    "code": 401,
    "message": "x-api-key: x-api-key is invalid",
    "type": "REST"
  }
}
```

Example — No access to resource:

```json
{
  "error": {
    "code": 401,
    "message": "User does not have access to requested resource.",
    "type": "Authorization"
  }
}
```

### 404

The referenced resource is accessible, but the requested item does not exist, for example a pending operation. IDs the caller can't access, or that don't exist at all, return `401` instead.

Content type: `application/json`

Type: `Error`

Example:

```json
{
  "error": {
    "code": 404,
    "message": "piece_id: Piece with ID 14460059 does not have outstanding Operation of type Recycle.",
    "type": "REST"
  }
}
```

### 409

The request conflicts with the current state of the resource.

Content type: `application/json`

Type: `Error`

### 422

The request body failed validation. The message names the invalid field.

Content type: `application/json`

Type: `Error`

Example:

```json
{
  "error": {
    "code": 422,
    "message": "label: must have a value",
    "type": "REST",
    "fields": {}
  }
}
```

## Schemas

### Error

Error envelope returned with 4xx and 5xx responses.

- `error` (object)
  - `code` (integer): Usually the HTTP status code. It can differ; a request to an unknown path returns HTTP 400 with code 500.
  - `message` (string): Human-readable description of the error.
  - `type` (string): The kind of error, for example `Authorization` or `REST`.
  - `fields` (object): Returned only with `422` responses. It may give more details about what failed validation, as lists of messages keyed by the name of the input.

### Tag

- `id` (integer)
- `created_at` (string<date-time>)
- `updated_at` (string<date-time>)
- `label` (string)
- `parent_tag_id` (integer or null)
- `piece_counts` (integer or null)

### TagInput

- `label` (string, required): The tag's label. Required. Must be unique within the inbox and must not be a reserved system label.
- `parent_tag_id` (integer or null): ID of the parent tag, to nest this tag under another tag in the same inbox. Optional. A tag cannot be its own parent.
