**Versions de l’API** · **V2 (Latest)** · [V1](/integrations/v1/docs?lang=fr)

# Galeries

OpenAPI 3.0.3 · API 2.0.0

```json
[
  {
    "url": "https://api.unisoft.world/integrations/v2",
    "description": "API"
  }
]
```

Galeries photo (collection `galeries`) — albums publiés par l’organisation sur son site web. CRUD complet des albums (nom, description, catégories, `compte` comptable) et gestion des images : ajout (téléversement multipart OU URL http(s) réhébergée côté serveur), suppression par nom de fichier et réorganisation. Les réponses de liste/détail exposent `nbImages` + une image de couverture, pas le tableau `images[]` complet — lisez les photos via GET /galleries/{id}/images. Autorisations : `galleries:read`/`galleries:write`.

## Opérations

## GET /galleries

Lister les galeries photo

`list_galleries`

Autorisation requise : `galleries:read`. Liste les galeries actives de l’organisation (sans `images[]` ; chacune contient `nbImages` et une image de couverture). Résultats paginés. Filtrez avec `?category` (catégorie), `?search` (recherche plein texte) ou `?contact` (identifiant d’un contact CRM).

### Authentification

```json
[
  {
    "bearerAuth": []
  },
  {
    "apiKeyHeader": []
  }
]
```

### Permissions requises

```json
{
  "accepted": "galleries:read",
  "additional": []
}
```

### Paramètres

```json
{
  "name": "limit",
  "in": "query",
  "schema": {
    "type": "integer",
    "minimum": 1,
    "maximum": 200,
    "default": 50
  },
  "description": "Nombre de résultats par page."
}
```

```json
{
  "name": "cursor",
  "in": "query",
  "schema": {
    "type": "string"
  },
  "description": "Curseur opaque renvoyé par la requête précédente."
}
```

```json
{
  "name": "category",
  "in": "query",
  "schema": {
    "type": "string"
  },
  "description": "Filtrer les galeries ayant cette catégorie."
}
```

```json
{
  "name": "search",
  "in": "query",
  "schema": {
    "type": "string"
  },
  "description": "Recherche plein texte dans les galeries."
}
```

```json
{
  "name": "contact",
  "in": "query",
  "schema": {
    "type": "string"
  },
  "description": "Filtrer les galeries associées à cet identifiant de contact CRM."
}
```

### Réponses

#### HTTP 200

```json
{
  "description": "OK",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Gallery"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/Pagination"
          }
        }
      }
    }
  }
}
```

#### HTTP 401

```json
{
  "description": "ERREUR",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "ERROR"
          }
        }
      }
    }
  }
}
```

#### HTTP 403

```json
{
  "description": "AUTORISATION_INSUFFISANTE",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "INSUFFICIENT_SCOPE"
          }
        }
      }
    }
  }
}
```

### OpenAPI

```json
{
  "x-unisoft-scope": "galleries:read",
  "x-unisoft-mcp": {
    "category": "read",
    "readOnly": true,
    "destructive": false,
    "idempotent": true,
    "warn": false
  }
}
```

## POST /galleries

Créer une galerie photo

`create_gallery`

Autorisation requise : `galleries:write`. Crée un album vide. Ajoutez ensuite des photos via POST /galleries/{id}/images.

### Authentification

```json
[
  {
    "bearerAuth": []
  },
  {
    "apiKeyHeader": []
  }
]
```

### Permissions requises

```json
{
  "accepted": "galleries:write",
  "additional": []
}
```

### Corps de la requête

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Nom d’affichage de l’album."
          },
          "description": {
            "type": "string",
            "description": "Description facultative."
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Catégories."
          },
          "compte": {
            "type": "string",
            "description": "Livret comptable : \"PRINCIPAL\" (général) ou identifiant d’une caisse virtuelle.",
            "default": "PRINCIPAL"
          },
          "contact": {
            "type": "string",
            "description": "Identifiant facultatif d’un contact CRM à associer."
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false,
        "description": "Créer une galerie photo (vide). Ajoutez des images ensuite via POST /galleries/{id}/images."
      }
    }
  }
}
```

### Réponses

#### HTTP 200

```json
{
  "description": "OK",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "$ref": "#/components/schemas/Gallery"
          }
        }
      }
    }
  }
}
```

#### HTTP 400

```json
{
  "description": "ERREUR_DE_VALIDATION",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "VALIDATION_ERROR"
          }
        }
      }
    }
  }
}
```

#### HTTP 403

```json
{
  "description": "AUTORISATION_INSUFFISANTE",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "INSUFFICIENT_SCOPE"
          }
        }
      }
    }
  }
}
```

### OpenAPI

```json
{
  "x-unisoft-scope": "galleries:write",
  "x-unisoft-mcp": {
    "category": "create",
    "readOnly": false,
    "destructive": false,
    "idempotent": false,
    "warn": false
  }
}
```

## GET /galleries/categories

Lister les catégories de galerie

`list_gallery_categories`

Autorisation requise : `galleries:read`. Renvoie les catégories distinctes utilisées dans les galeries de l’organisation (utile pour renseigner le filtre `category` ou réutiliser une catégorie existante lors d’une création/modification).

### Authentification

```json
[
  {
    "bearerAuth": []
  },
  {
    "apiKeyHeader": []
  }
]
```

### Permissions requises

```json
{
  "accepted": "galleries:read",
  "additional": []
}
```

### Réponses

#### HTTP 200

```json
{
  "description": "OK",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
```

#### HTTP 401

```json
{
  "description": "ERREUR",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "ERROR"
          }
        }
      }
    }
  }
}
```

#### HTTP 403

```json
{
  "description": "AUTORISATION_INSUFFISANTE",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "INSUFFICIENT_SCOPE"
          }
        }
      }
    }
  }
}
```

### OpenAPI

```json
{
  "x-unisoft-scope": "galleries:read",
  "x-unisoft-mcp": {
    "category": "read",
    "readOnly": true,
    "destructive": false,
    "idempotent": true,
    "warn": false
  }
}
```

## GET /galleries/{id}

Obtenir une galerie photo

`get_gallery`

Autorisation requise : `galleries:read`. Renvoie les métadonnées de l’album, `nbImages` et l’image de couverture (PAS la liste complète des images — utilisez GET /galleries/{id}/images).

### Authentification

```json
[
  {
    "bearerAuth": []
  },
  {
    "apiKeyHeader": []
  }
]
```

### Permissions requises

```json
{
  "accepted": "galleries:read",
  "additional": []
}
```

### Paramètres

```json
{
  "name": "id",
  "in": "path",
  "required": true,
  "schema": {
    "type": "string",
    "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
    "format": "uuid"
  },
  "description": "Identifiant de la ressource cible existante, renvoyé par son opération de liste ou de lecture autorisée. Ne générez jamais un nouvel UUID pour cibler un enregistrement existant."
}
```

### Réponses

#### HTTP 200

```json
{
  "description": "OK",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "$ref": "#/components/schemas/Gallery"
          }
        }
      }
    }
  }
}
```

#### HTTP 404

```json
{
  "description": "NOT_FOUND",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "NOT_FOUND"
          }
        }
      }
    }
  }
}
```

### OpenAPI

```json
{
  "x-unisoft-scope": "galleries:read",
  "x-unisoft-mcp": {
    "category": "read",
    "readOnly": true,
    "destructive": false,
    "idempotent": true,
    "warn": false
  }
}
```

## PATCH /galleries/{id}

Modifier une galerie photo

`update_gallery`

Autorisation requise : `galleries:write`. Mise à jour partielle des métadonnées de l’album (nom/description/catégories/compte/contact). Les images se gèrent via les opérations dédiées.

### Authentification

```json
[
  {
    "bearerAuth": []
  },
  {
    "apiKeyHeader": []
  }
]
```

### Permissions requises

```json
{
  "accepted": "galleries:write",
  "additional": []
}
```

### Paramètres

```json
{
  "name": "id",
  "in": "path",
  "required": true,
  "schema": {
    "type": "string",
    "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
    "format": "uuid"
  },
  "description": "Identifiant de la ressource cible existante, renvoyé par son opération de liste ou de lecture autorisée. Ne générez jamais un nouvel UUID pour cibler un enregistrement existant."
}
```

### Corps de la requête

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Nouveau nom d’affichage (non vide s’il est fourni)."
          },
          "description": {
            "type": "string",
            "description": "Nouvelle description."
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Remplace les catégories."
          },
          "compte": {
            "type": "string",
            "description": "Nouveau livret comptable (\"PRINCIPAL\" ou identifiant d’une caisse)."
          },
          "contact": {
            "type": "string",
            "nullable": true,
            "description": "Associer/dissocier un contact CRM (null pour le dissocier)."
          }
        },
        "additionalProperties": false,
        "description": "Mettre à jour les métadonnées d’une galerie (mise à jour partielle). Seuls les champs envoyés sont modifiés ; les images ne sont jamais modifiées ici (utilisez les opérations dédiées aux images)."
      }
    }
  }
}
```

### Réponses

#### HTTP 200

```json
{
  "description": "OK",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "$ref": "#/components/schemas/Gallery"
          }
        }
      }
    }
  }
}
```

#### HTTP 400

```json
{
  "description": "ERREUR_DE_VALIDATION",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "VALIDATION_ERROR"
          }
        }
      }
    }
  }
}
```

#### HTTP 404

```json
{
  "description": "NOT_FOUND",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "NOT_FOUND"
          }
        }
      }
    }
  }
}
```

### OpenAPI

```json
{
  "x-unisoft-scope": "galleries:write",
  "x-unisoft-mcp": {
    "category": "update",
    "readOnly": false,
    "destructive": false,
    "idempotent": true,
    "warn": false
  }
}
```

## DELETE /galleries/{id}

Supprimer une galerie photo

`delete_gallery`

Autorisation requise : `galleries:write`. Supprime logiquement l’album (masqué du site et des listes ; le document est conservé).

### Authentification

```json
[
  {
    "bearerAuth": []
  },
  {
    "apiKeyHeader": []
  }
]
```

### Permissions requises

```json
{
  "accepted": "galleries:write",
  "additional": []
}
```

### Paramètres

```json
{
  "name": "id",
  "in": "path",
  "required": true,
  "schema": {
    "type": "string",
    "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
    "format": "uuid"
  },
  "description": "Identifiant de la ressource cible existante, renvoyé par son opération de liste ou de lecture autorisée. Ne générez jamais un nouvel UUID pour cibler un enregistrement existant."
}
```

### Réponses

#### HTTP 200

```json
{
  "description": "OK",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        }
      }
    }
  }
}
```

#### HTTP 404

```json
{
  "description": "NOT_FOUND",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "NOT_FOUND"
          }
        }
      }
    }
  }
}
```

### OpenAPI

```json
{
  "x-unisoft-scope": "galleries:write",
  "x-unisoft-mcp": {
    "category": "delete",
    "readOnly": false,
    "destructive": true,
    "idempotent": true,
    "warn": false
  }
}
```

## GET /galleries/{id}/images

Lister les images d’une galerie

`list_gallery_images`

Autorisation requise : `galleries:read`. Renvoie une page de noms de fichiers image de l’album ("md5.ext") et leurs URL publiques dans `meta.imageUrls`. Pagination par page : `?page` (indexée à partir de 1) et `?limit` (30 par défaut).

### Authentification

```json
[
  {
    "bearerAuth": []
  },
  {
    "apiKeyHeader": []
  }
]
```

### Permissions requises

```json
{
  "accepted": "galleries:read",
  "additional": []
}
```

### Paramètres

```json
{
  "name": "id",
  "in": "path",
  "required": true,
  "schema": {
    "type": "string",
    "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
    "format": "uuid"
  },
  "description": "Identifiant de la ressource cible existante, renvoyé par son opération de liste ou de lecture autorisée. Ne générez jamais un nouvel UUID pour cibler un enregistrement existant."
}
```

```json
{
  "name": "page",
  "in": "query",
  "schema": {
    "type": "integer",
    "minimum": 1,
    "default": 1
  }
}
```

```json
{
  "name": "limit",
  "in": "query",
  "schema": {
    "type": "integer",
    "minimum": 1,
    "maximum": 200,
    "default": 30
  }
}
```

### Réponses

#### HTTP 200

```json
{
  "description": "OK",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
```

#### HTTP 404

```json
{
  "description": "NOT_FOUND",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "NOT_FOUND"
          }
        }
      }
    }
  }
}
```

### OpenAPI

```json
{
  "x-unisoft-scope": "galleries:read",
  "x-unisoft-mcp": {
    "category": "read",
    "readOnly": true,
    "destructive": false,
    "idempotent": true,
    "warn": false
  }
}
```

## POST /galleries/{id}/images

Ajouter des images à une galerie

`add_gallery_images`

Autorisation requise : `galleries:write`. Ajoute des images à l’album. Envoyez SOIT un ou plusieurs champs de fichier image multipart/form-data (5 Mo maximum chacun, image/* uniquement), SOIT un corps JSON {images:[url|filename]} (les URL http(s) sont réhébergées côté serveur ; les noms de fichiers "md5.ext" déjà hébergés sont joints tels quels). Les doublons sont ignorés. Un agent MCP/IA doit utiliser le format JSON avec des URL.

### Authentification

```json
[
  {
    "bearerAuth": []
  },
  {
    "apiKeyHeader": []
  }
]
```

### Permissions requises

```json
{
  "accepted": "galleries:write",
  "additional": []
}
```

### Paramètres

```json
{
  "name": "id",
  "in": "path",
  "required": true,
  "schema": {
    "type": "string",
    "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
    "format": "uuid"
  },
  "description": "Identifiant de la ressource cible existante, renvoyé par son opération de liste ou de lecture autorisée. Ne générez jamais un nouvel UUID pour cibler un enregistrement existant."
}
```

### Corps de la requête

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "images": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string"
            },
            "description": "URLs d’images http(s) (réhébergées) ou noms de fichiers \"md5.ext\" déjà hébergés."
          }
        },
        "required": [
          "images"
        ],
        "additionalProperties": false,
        "description": "Ajouter des images à une galerie. DEUX modes de transmission sont acceptés sur POST /galleries/{id}/images :\n• multipart/form-data — envoyez un ou plusieurs champs de fichier image (n’importe quel nom de champ). À privilégier avec un client HTTP (Make/n8n/application). 5 Mo maximum par image, image/* uniquement.\n• application/json — ce schéma : chaque entrée `images` est une URL http(s) (téléchargée puis réhébergée côté serveur) ou un nom de fichier \"md5.ext\" déjà hébergé. C’est le mode utilisé par un agent MCP/IA (il ne peut pas transmettre un flux binaire).\nLes doublons (image déjà présente dans l’album) sont ignorés. Les fichiers réhébergés sont dédoublonnés selon leur contenu."
      }
    },
    "multipart/form-data": {
      "schema": {
        "type": "object",
        "minProperties": 1,
        "maxProperties": 20,
        "additionalProperties": {
          "oneOf": [
            {
              "type": "string",
              "format": "binary"
            },
            {
              "type": "array",
              "minItems": 1,
              "maxItems": 20,
              "items": {
                "type": "string",
                "format": "binary"
              }
            }
          ]
        }
      },
      "x-unisoft-file-policy": [
        {
          "contentType": "image/*",
          "maxBytes": 5242880
        }
      ]
    }
  }
}
```

### Réponses

#### HTTP 200

```json
{
  "description": "OK",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "added": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "addedUrls": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "nbImages": {
                "type": "integer"
              }
            }
          }
        }
      }
    }
  }
}
```

#### HTTP 400

```json
{
  "description": "ERREUR_DE_VALIDATION",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "VALIDATION_ERROR"
          }
        }
      }
    }
  }
}
```

#### HTTP 404

```json
{
  "description": "NOT_FOUND",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "NOT_FOUND"
          }
        }
      }
    }
  }
}
```

### OpenAPI

```json
{
  "x-unisoft-scope": "galleries:write",
  "x-unisoft-mcp": {
    "category": "create",
    "readOnly": false,
    "destructive": false,
    "idempotent": false,
    "warn": false
  }
}
```

## DELETE /galleries/{id}/images

Retirer des images d’une galerie

`remove_gallery_images`

Autorisation requise : `galleries:write`. Détache les images de l’album par leur nom de fichier hébergé. Les fichiers physiques ne sont pas supprimés.

### Authentification

```json
[
  {
    "bearerAuth": []
  },
  {
    "apiKeyHeader": []
  }
]
```

### Permissions requises

```json
{
  "accepted": "galleries:write",
  "additional": []
}
```

### Paramètres

```json
{
  "name": "id",
  "in": "path",
  "required": true,
  "schema": {
    "type": "string",
    "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
    "format": "uuid"
  },
  "description": "Identifiant de la ressource cible existante, renvoyé par son opération de liste ou de lecture autorisée. Ne générez jamais un nouvel UUID pour cibler un enregistrement existant."
}
```

### Corps de la requête

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "images": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Noms de fichiers hébergés (\"md5.ext\") actuellement présents dans l’album, à détacher."
          }
        },
        "required": [
          "images"
        ],
        "additionalProperties": false,
        "description": "Retirer des images d’une galerie en indiquant leur nom de fichier hébergé. Les fichiers physiques ne sont PAS supprimés (ils peuvent être utilisés ailleurs) — seule leur référence dans cet album est supprimée."
      }
    }
  }
}
```

### Réponses

#### HTTP 200

```json
{
  "description": "OK",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "removed": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "nbImages": {
                "type": "integer"
              }
            }
          }
        }
      }
    }
  }
}
```

#### HTTP 400

```json
{
  "description": "ERREUR_DE_VALIDATION",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "VALIDATION_ERROR"
          }
        }
      }
    }
  }
}
```

#### HTTP 404

```json
{
  "description": "NOT_FOUND",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "NOT_FOUND"
          }
        }
      }
    }
  }
}
```

### OpenAPI

```json
{
  "x-unisoft-scope": "galleries:write",
  "x-unisoft-mcp": {
    "category": "delete",
    "readOnly": false,
    "destructive": true,
    "idempotent": true,
    "warn": false
  }
}
```

## POST /galleries/{id}/images/reorder

Réorganiser les images d’une galerie

`reorder_gallery_images`

Autorisation requise : `galleries:write`. Définit l’ordre d’affichage des images de l’album. `order` doit être une permutation des noms de fichiers actuels ; les images omises sont ajoutées à la fin dans leur ordre actuel (aucune n’est perdue). La première image devient la couverture.

### Authentification

```json
[
  {
    "bearerAuth": []
  },
  {
    "apiKeyHeader": []
  }
]
```

### Permissions requises

```json
{
  "accepted": "galleries:write",
  "additional": []
}
```

### Paramètres

```json
{
  "name": "id",
  "in": "path",
  "required": true,
  "schema": {
    "type": "string",
    "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
    "format": "uuid"
  },
  "description": "Identifiant de la ressource cible existante, renvoyé par son opération de liste ou de lecture autorisée. Ne générez jamais un nouvel UUID pour cibler un enregistrement existant."
}
```

### Corps de la requête

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "order": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Noms de fichiers hébergés dans l’ordre souhaité."
          }
        },
        "required": [
          "order"
        ],
        "additionalProperties": false,
        "description": "Définir l’ordre d’affichage des images d’une galerie. `order` doit être une permutation des noms de fichiers actuels de l’album ; toute image omise est ajoutée à la fin dans son ordre actuel (aucune image n’est perdue), et les noms inconnus sont ignorés. La première image devient la couverture de l’album."
      }
    }
  }
}
```

### Réponses

#### HTTP 200

```json
{
  "description": "OK",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "images": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  }
}
```

#### HTTP 400

```json
{
  "description": "ERREUR_DE_VALIDATION",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "VALIDATION_ERROR"
          }
        }
      }
    }
  }
}
```

#### HTTP 404

```json
{
  "description": "NOT_FOUND",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "example": "NOT_FOUND"
          }
        }
      }
    }
  }
}
```

### OpenAPI

```json
{
  "x-unisoft-scope": "galleries:write",
  "x-unisoft-mcp": {
    "category": "reorder",
    "readOnly": false,
    "destructive": false,
    "idempotent": true,
    "warn": false
  }
}
```

## Schémas

```json
{
  "components": {
    "schemas": {
      "Gallery": {
        "type": "object",
        "description": "Galerie photo (collection `galeries`) — album photo publié par l’organisation sur son site web (pages de thème « Galeries » / « GalerieImages »). Les réponses de liste/détail n’incluent PAS le tableau complet `images[]` (qui peut être volumineux) ; elles exposent `nbImages` et l’image de couverture. Récupérez les images via GET /galleries/{id}/images.",
        "properties": {
          "id": {
            "type": "string",
            "readOnly": true,
            "description": "UUID de la galerie généré par le serveur."
          },
          "name": {
            "type": "string",
            "description": "Nom d’affichage de l’album."
          },
          "description": {
            "type": "string",
            "description": "Description facultative affichée sous le titre de l’album."
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Catégories en texte libre utilisées pour regrouper/filtrer les albums (par ex. « Fêtes », « Chabbat »)."
          },
          "compte": {
            "type": "string",
            "description": "Livret comptable auquel l’album est rattaché : \"PRINCIPAL\" (général) ou identifiant d’une caisse virtuelle. \"PRINCIPAL\" par défaut."
          },
          "contact": {
            "type": "string",
            "nullable": true,
            "description": "Identifiant facultatif d’un contact CRM auquel l’album est associé."
          },
          "nbImages": {
            "type": "integer",
            "readOnly": true,
            "description": "Nombre d’images dans l’album (calculé)."
          },
          "bgImage": {
            "type": "string",
            "nullable": true,
            "readOnly": true,
            "description": "Image de couverture = nom du fichier hébergé de la première image (\"md5.ext\"), ou null si l’album est vide."
          },
          "bgImageUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "readOnly": true,
            "description": "URL publique de l’image de couverture (null si l’album est vide)."
          },
          "active": {
            "type": "boolean",
            "readOnly": true,
            "description": "false après suppression logique (masquée du site et des listes)."
          },
          "datetime": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        }
      },
      "Pagination": {
        "type": "object",
        "properties": {
          "nextCursor": {
            "type": "string",
            "nullable": true
          },
          "hasMore": {
            "type": "boolean"
          },
          "count": {
            "type": "integer"
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key",
        "description": "Format : `ke_live_xxx`"
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    }
  }
}
```
