---
title: "Sets the order of a resource's attachments."
---

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

Path: Sherpo merchant API › file

`POST /v1/stores/{store}/{kind}/{id}/attachments/reorder`

## Authentication

- `bearer`, http, header `Authorization`, scopes: `file:write`

## Path parameters

- `store` (`reorderAttachments.path.store`; string, required) — The store's id.
- `kind` (`reorderAttachments.path.kind`; string, required) — The target's kind, in the plural.
  - minLength 1
- `id` (`reorderAttachments.path.id`; string, required)
  - minLength 1

## Header parameters

- `Idempotency-Key` (`reorderAttachments.header.Idempotency-Key`; string, optional) — Repeats within 24 hours answer the first result; the same key with other arguments is a conflict.
  - minLength 1; maxLength 255; pattern `^[\x21-\x7E]+$`

## Request body

_Required._

- `role` (`reorderAttachments.role`; string, required)
  - one of `"body"`, `"staged"`, `"staged_file"`, `"prose"`, `"teaser"`, `"embed"`, `"deliverable"`, `"poster"`, `"logo"`, `"prompt"`, `"stylesheet"`
- `attachments` (`reorderAttachments.attachments`; array<object>, required)
  - `id` (`reorderAttachments.attachments.id`; string, required)
    - minLength 1; maxLength 512
- `expect` (`reorderAttachments.expect`; array<object>, optional) — The group's order as the caller read it; another order now refuses.
  - `id` (`reorderAttachments.expect.id`; string, required)
    - minLength 1; maxLength 512

## Example request

```json
{
  "role": "body",
  "attachments": [
    {
      "id": "string"
    }
  ],
  "expect": [
    {
      "id": "string"
    }
  ]
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.sherpo.io/merchant/v1/stores/<store>/<kind>/<id>/attachments/reorder' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "role": "body",
  "attachments": [
    {
      "id": "string"
    }
  ],
  "expect": [
    {
      "id": "string"
    }
  ]
}
'
```

### TypeScript

```typescript
const url = 'https://api.sherpo.io/merchant/v1/stores/<store>/<kind>/<id>/attachments/reorder';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({role: 'body', attachments: [{id: 'string'}], expect: [{id: 'string'}]})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.sherpo.io/merchant/v1/stores/<store>/<kind>/<id>/attachments/reorder"

payload = {
    "role": "body",
    "attachments": [{ "id": "string" }],
    "expect": [{ "id": "string" }]
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Sets the order of a resource's attachments.

#### Example

```json
[
  {
    "id": "string",
    "target": {
      "kind": "string",
      "id": "string"
    },
    "role": "string",
    "delivery": "string",
    "preview_only": true,
    "from_body": true,
    "release_file": true,
    "position": 0,
    "asset": {
      "id": "string",
      "locator": "string",
      "origin": "string",
      "custodian": "string",
      "enforcement": "string",
      "mime": "string",
      "bytes": 0,
      "quota_bytes": 0,
      "name": "string",
      "title": "string",
      "ext": "string",
      "status": "string",
      "optimized": true,
      "parent_id": "string",
      "redacted": true,
      "security": "string",
      "description": "string",
      "processed_at": "string",
      "metadata": {
        "width": 0,
        "height": 0,
        "duration": 0,
        "pages": 0,
        "waveform": "string",
        "transcript": {
          "language": "string",
          "confidence": 0
        },
        "arguments": [
          {
            "name": "string",
            "description": "string",
            "required": true,
            "default": "string",
            "match": "string",
            "flags": "string",
            "message": "string",
            "lenient": true
          }
        ],
        "property1": true,
        "property2": true
      },
      "created_at": "string"
    }
  }
]
```

- `id` (`reorderAttachments.response.200.id`; string, required)
- `target` (`reorderAttachments.response.200.target`; object, required)
  - `kind` (`reorderAttachments.response.200.target.kind`; string, required)
  - `id` (`reorderAttachments.response.200.target.id`; string, required)
- `role` (`reorderAttachments.response.200.role`; string, required)
- `delivery` (`reorderAttachments.response.200.delivery`; string, required)
- `preview_only` (`reorderAttachments.response.200.preview_only`; boolean, required)
- `from_body` (`reorderAttachments.response.200.from_body`; boolean, required)
- `release_file` (`reorderAttachments.response.200.release_file`; boolean, required) — A file a software release ships, which its release edits and the product's own list leaves out.
- `position` (`reorderAttachments.response.200.position`; number, required)
- `asset` (`reorderAttachments.response.200.asset`; object, required)
  - `id` (`reorderAttachments.response.200.asset.id`; string, required)
  - `locator` (`reorderAttachments.response.200.asset.locator`; any of, required)
    - any of: `string`, `null`
  - `origin` (`reorderAttachments.response.200.asset.origin`; string, required)
  - `custodian` (`reorderAttachments.response.200.asset.custodian`; string, required)
  - `enforcement` (`reorderAttachments.response.200.asset.enforcement`; string, required)
  - `mime` (`reorderAttachments.response.200.asset.mime`; any of, required)
    - any of: `string`, `null`
  - `bytes` (`reorderAttachments.response.200.asset.bytes`; any of, required) — The file's size in bytes; null when it is charged nothing.
    - any of: `number`, `null`
  - `quota_bytes` (`reorderAttachments.response.200.asset.quota_bytes`; number, required) — The file's size in bytes; zero when it is charged nothing.
  - `name` (`reorderAttachments.response.200.asset.name`; string, required)
  - `title` (`reorderAttachments.response.200.asset.title`; any of, required)
    - any of: `string`, `null`
  - `ext` (`reorderAttachments.response.200.asset.ext`; any of, required)
    - any of: `string`, `null`
  - `status` (`reorderAttachments.response.200.asset.status`; string, required)
  - `optimized` (`reorderAttachments.response.200.asset.optimized`; boolean, required)
  - `parent_id` (`reorderAttachments.response.200.asset.parent_id`; any of, required)
    - any of: `string`, `null`
  - `redacted` (`reorderAttachments.response.200.asset.redacted`; boolean, required)
  - `security` (`reorderAttachments.response.200.asset.security`; any of, required)
    - any of: `string`, `null`
  - `description` (`reorderAttachments.response.200.asset.description`; any of, required)
    - any of: `string`, `null`
  - `processed_at` (`reorderAttachments.response.200.asset.processed_at`; any of, required)
    - any of: `string`, `null`
  - `metadata` (`reorderAttachments.response.200.asset.metadata`; object, required)
    - `width` (`reorderAttachments.response.200.asset.metadata.width`; integer, optional)
      - min 0
    - `height` (`reorderAttachments.response.200.asset.metadata.height`; integer, optional)
      - min 0
    - `duration` (`reorderAttachments.response.200.asset.metadata.duration`; number, optional) — Seconds, measured, so rarely whole.
    - `pages` (`reorderAttachments.response.200.asset.metadata.pages`; integer, optional)
      - min 0
    - `waveform` (`reorderAttachments.response.200.asset.metadata.waveform`; any of, optional) — An audio file's waveform: 256 levels from 0 to 255, base64; null when it can't be drawn.
      - any of: `string`, `null`
    - `transcript` (`reorderAttachments.response.200.asset.metadata.transcript`; object, optional)
      - `language` (`reorderAttachments.response.200.asset.metadata.transcript.language`; string, optional)
      - `confidence` (`reorderAttachments.response.200.asset.metadata.transcript.confidence`; number, optional)
    - `arguments` (`reorderAttachments.response.200.asset.metadata.arguments`; array<object>, optional) — What an MCP prompt asks for; only an authored prompt carries it.
      - `name` (`reorderAttachments.response.200.asset.metadata.arguments.name`; string, required)
      - `description` (`reorderAttachments.response.200.asset.metadata.arguments.description`; any of, required)
        - any of: `string`, `null`
      - `required` (`reorderAttachments.response.200.asset.metadata.arguments.required`; boolean, required)
      - `default` (`reorderAttachments.response.200.asset.metadata.arguments.default`; any of, required)
        - any of: `string`, `null`
      - `match` (`reorderAttachments.response.200.asset.metadata.arguments.match`; any of, required) — Pattern the whole value must match, diacritic-insensitive.
        - any of: `string`, `null`
      - `flags` (`reorderAttachments.response.200.asset.metadata.arguments.flags`; any of, required) — Flags among `i`, `s` and `u` the pattern runs with; null for `i` alone.
        - any of: `string`, `null`
      - `message` (`reorderAttachments.response.200.asset.metadata.arguments.message`; any of, required) — What a refused value is told instead of the default reason.
        - any of: `string`, `null`
      - `lenient` (`reorderAttachments.response.200.asset.metadata.arguments.lenient`; boolean, required)
  - `created_at` (`reorderAttachments.response.200.asset.created_at`; any of, required)
    - any of: `string`, `null`

### default

A problem; see https://api.sherpo.io/merchant/docs/errors.

#### Example

```json
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "context": {},
  "reached_core": true,
  "core_answer": "string"
}
```

- `type` (`reorderAttachments.response.default.type`; string, required)
  - format `uri`
- `title` (`reorderAttachments.response.default.title`; string, required)
- `status` (`reorderAttachments.response.default.status`; integer, required)
- `detail` (`reorderAttachments.response.default.detail`; string, required)
- `code` (`reorderAttachments.response.default.code`; string, optional)
- `context` (`reorderAttachments.response.default.context`; object, optional)
- `reached_core` (`reorderAttachments.response.default.reached_core`; boolean, optional)
- `core_answer` (`reorderAttachments.response.default.core_answer`; string, optional)


Source: https://docs.sherpo.io/merchant-api/reference/reorder-attachments/index.md
