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

> **Cette version de l’API est obsolète.** Utilisez la dernière version pour toute nouvelle intégration. [Voir la documentation actuelle](/integrations/v2/docs?lang=fr)

# Téléversements

OpenAPI 3.0.3 · API 1.0.0

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

Hébergement TRANSVERSAL des fichiers : téléversez un fichier UNE FOIS (POST /uploads pour tout média, /uploads/image, /uploads/pdf) et récupérez un nom de fichier hébergé + une URL, puis associez-les à leur ressource (document de contact, média de campagne, image de page). Reprend le parcours admin « téléverser d’abord, associer ensuite ». Multipart uniquement — un agent MCP/IA incapable d’envoyer un flux binaire transmet directement une URL http(s) à l’endpoint qui consomme le fichier (réhébergée côté serveur). Autorisation : `uploads:write` (une clé `messages:write` est également acceptée sur POST /uploads générique).

## Opérations

## POST /uploads

Téléverser un fichier média (tout type)

`create_upload`

Autorisation requise : `uploads:write` (une clé `messages:write` est AUSSI acceptée pour le parcours de campagne). Téléverse une image/PDF/vidéo (multipart/form-data) et renvoie le nom de fichier hébergé + l’URL, à ASSOCIER ensuite à sa ressource (document de contact, média de campagne…). REMARQUE : multipart uniquement — un agent MCP/IA incapable d’envoyer un flux binaire doit transmettre une URL http(s) dans `url` à l’opération qui consomme le fichier (par ex. POST /contacts/{id}/documents), qui le réhéberge côté serveur.

### Authentification

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

### Permissions requises

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

### Corps de la requête

```json
{
  "required": true,
  "content": {
    "multipart/form-data": {
      "schema": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string",
            "format": "binary"
          }
        }
      }
    }
  }
}
```

### Réponses

#### HTTP 200

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

#### HTTP 400

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

#### 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": "uploads:write",
  "x-unisoft-mcp": {
    "category": "create",
    "readOnly": false,
    "destructive": false,
    "idempotent": false,
    "warn": false
  }
}
```

## POST /uploads/image

Téléverser une image

`create_upload_image`

Autorisation requise : `uploads:write`. Téléverse uniquement une image (image/*, ≤ 5 Mo, multipart/form-data) et renvoie son nom de fichier hébergé + son URL. Suit le fonctionnement du téléversement d’images admin. Multipart uniquement (voir la remarque de POST /uploads pour MCP/IA).

### Authentification

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

### Permissions requises

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

### Corps de la requête

```json
{
  "required": true,
  "content": {
    "multipart/form-data": {
      "schema": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string",
            "format": "binary"
          }
        }
      }
    }
  }
}
```

### Réponses

#### HTTP 200

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

#### HTTP 400

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

#### 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": "uploads:write",
  "x-unisoft-mcp": {
    "category": "create",
    "readOnly": false,
    "destructive": false,
    "idempotent": false,
    "warn": false
  }
}
```

## POST /uploads/pdf

Téléverser un PDF

`create_upload_pdf`

Autorisation requise : `uploads:write`. Téléverse uniquement un PDF (application/pdf, ≤ 15 Mo, multipart/form-data) et renvoie son nom de fichier hébergé + son URL. Suit le fonctionnement du téléversement de documents admin. Multipart uniquement (voir la remarque de POST /uploads pour MCP/IA).

### Authentification

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

### Permissions requises

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

### Corps de la requête

```json
{
  "required": true,
  "content": {
    "multipart/form-data": {
      "schema": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string",
            "format": "binary"
          }
        }
      }
    }
  }
}
```

### Réponses

#### HTTP 200

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

#### HTTP 400

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

#### 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": "uploads:write",
  "x-unisoft-mcp": {
    "category": "create",
    "readOnly": false,
    "destructive": false,
    "idempotent": false,
    "warn": false
  }
}
```

## Schémas

```json
{
  "components": {
    "schemas": {
      "UploadResult": {
        "type": "object",
        "properties": {
          "filename": {
            "type": "string",
            "description": "Nom de fichier hébergé — à placer dans `docs[].doc` / `videos[].doc` d’une campagne."
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "mimetype": {
            "type": "string"
          },
          "size": {
            "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"
      }
    }
  }
}
```
