# reorder_queued_message

Source: https://modulify.ai/docs/api/chat/reorder-queued-message

Moves a message that is still waiting in a site's queue so it runs earlier or later.

- Title: Move a queued message
- Scope: `chat:write`
- Access: Makes changes
- Endpoint: `POST /v1/reorder_queued_message`

Name its new neighbors by their `Id`. `beforeId` is the entry it should sit after, and `afterId` the entry it should sit before. Send at least one of them, and send both to drop it exactly between them.

Sending only one is reliable at the ends of the queue: `beforeId` naming the last entry moves it to the end, and `afterId` naming the first entry moves it to the front. Anywhere in the middle, send both. Both have to be entries that are still queued, so read `list_queued_messages` first.

Anyone in the workspace can move any queued message, not only their own, and moving yours ahead of somebody else's delays theirs. See [Reorder](https://modulify.ai/docs/build/message-queue#reorder).

## Request

Call it with a `POST` to `https://api.modulify.ai/v1/reorder_queued_message`, sending the inputs below as a JSON object. The token needs the `chat:write` scope.

It makes changes, so send an [Idempotency-Key](https://modulify.ai/docs/api/idempotency) header whenever you might retry it. A retry with the same key gets the first answer back instead of running again.

```bash
curl -X POST https://api.modulify.ai/v1/reorder_queued_message \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"projectId":"PROJECT_ID","itemId":"ITEM_ID"}'
```

Over MCP, the same method is the [reorder_queued_message tool](https://modulify.ai/docs/mcp/chat/reorder-queued-message).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id, from `list_sites` or `get_site`. |
| `itemId` | string | Yes | The `Id` of the queued message to move, exactly as `list_queued_messages` reported it. |
| `beforeId` | string | No | The `Id` of the queued message this one should sit after. Send this, `afterId` or both. |
| `afterId` | string | No | The `Id` of the queued message this one should sit before. Send this, `beforeId` or both. |

## Response

Every call answers with the [JSON envelope](https://modulify.ai/docs/api/requests-and-responses#the-response) of `success`, `message`, `data`, `code` and `version`. `data` holds the result described above, and on a method that returns a total, `count` carries it. The [response headers](https://modulify.ai/docs/api/requests-and-responses#headers-on-every-method-call) carry the call's `X-Request-Id` and what is left of your per-minute budget in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. [Errors](https://modulify.ai/docs/api/errors) explains every status code a call can answer with.