{
  "openapi": "3.1.0",
  "info": {
    "title": "EnariLab · API langue",
    "description": "Transcription de la parole en langues du Bénin, traduction en français, anonymisation et classement des messages d'appel. Accès sur invitation (en-tête X-API-Key), service disponible sur demande. Modèles Meta (CC-BY-NC 4.0) : usage non commercial.",
    "version": "2.0.0"
  },
  "paths": {
    "/v2/sante": {
      "get": {
        "tags": [
          "informations"
        ],
        "summary": "Sante",
        "operationId": "sante_v2_sante_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/v2/langues": {
      "get": {
        "tags": [
          "informations"
        ],
        "summary": "Langues",
        "description": "Ce que chaque langue sait faire. `dialogue` : \"complet\" (compréhension par traduction + mots-clés locaux),\n\"mots_cles_locaux\" (seulement si des locuteurs ont rempli des mots-clés), \"aucun\".",
        "operationId": "langues_v2_langues_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/v2/taxonomie": {
      "get": {
        "tags": [
          "analyse"
        ],
        "summary": "Get Taxonomie",
        "description": "Taxonomie ABMS complète (C1–C6 + U), versionnée. Les mots-clés fon, yor et ewe restent à remplir.",
        "operationId": "get_taxonomie_v2_taxonomie_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/v2/asr": {
      "post": {
        "tags": [
          "briques"
        ],
        "summary": "Asr",
        "description": "Fichier son (WAV, OGG, MP3 ; WebM/M4A/Opus si ffmpeg est installé), 30 s max -> texte et confiance par mot.",
        "operationId": "asr_v2_asr_post",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_asr_v2_asr_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "CleApi": []
          }
        ]
      }
    },
    "/v2/traduire": {
      "post": {
        "tags": [
          "briques"
        ],
        "summary": "Traduire",
        "operationId": "traduire_v2_traduire_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DemandeTraduction"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "CleApi": []
          }
        ]
      }
    },
    "/v2/analyser/texte": {
      "post": {
        "tags": [
          "analyse"
        ],
        "summary": "Analyser Texte",
        "description": "Analyse une interaction déjà transcrite : anonymisation, traduction, classes C1–C6 + U, urgence, à relire.\n\nLe consentement est obligatoire. Rien n'est stocké sauf si `ENARI_CORPUS_ACTIF=1` ; dans ce cas, seul le texte\nanonymisé est écrit (et l'audio aussi si `ENARI_CORPUS_AUDIO=1` et si l'entrée est un audio).",
        "operationId": "analyser_texte_v2_analyser_texte_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DemandeAnalyse"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "CleApi": []
          }
        ]
      }
    },
    "/v2/analyser": {
      "post": {
        "tags": [
          "analyse"
        ],
        "summary": "Analyser",
        "description": "Analyse une note vocale (multipart) ou un texte : transcription, anonymisation, traduction, classes ABMS.\n\nEnvoyez `audio` **ou** `texte`, pas les deux. `noms` et `lieux` sont des listes séparées par des virgules.",
        "operationId": "analyser_v2_analyser_post",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_analyser_v2_analyser_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "CleApi": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "Body_analyser_v2_analyser_post": {
        "properties": {
          "audio": {
            "anyOf": [
              {
                "type": "string",
                "contentMediaType": "application/octet-stream"
              },
              {
                "type": "null"
              }
            ],
            "title": "Audio"
          },
          "texte": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Texte"
          },
          "langue": {
            "type": "string",
            "title": "Langue"
          },
          "consentement": {
            "type": "boolean",
            "title": "Consentement"
          },
          "texte_fr": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Texte Fr"
          },
          "anonymiser": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Anonymiser"
          },
          "noms": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Noms"
          },
          "lieux": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Lieux"
          },
          "source": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source"
          },
          "canal": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Canal"
          },
          "zone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Zone"
          },
          "external_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "External Id"
          },
          "recu_le": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recu Le"
          }
        },
        "type": "object",
        "required": [
          "langue",
          "consentement"
        ],
        "title": "Body_analyser_v2_analyser_post"
      },
      "Body_asr_v2_asr_post": {
        "properties": {
          "audio": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "Audio"
          },
          "langue": {
            "type": "string",
            "title": "Langue"
          }
        },
        "type": "object",
        "required": [
          "audio",
          "langue"
        ],
        "title": "Body_asr_v2_asr_post"
      },
      "DemandeAnalyse": {
        "properties": {
          "texte": {
            "type": "string",
            "maxLength": 2000,
            "minLength": 1,
            "title": "Texte"
          },
          "langue": {
            "type": "string",
            "title": "Langue"
          },
          "consentement": {
            "type": "boolean",
            "title": "Consentement",
            "description": "Doit être true. Sans consentement, l'analyse est refusée (403)."
          },
          "texte_fr": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ],
            "title": "Texte Fr",
            "description": "Traduction déjà faite par l'appelant (facultatif)"
          },
          "anonymiser": {
            "type": "boolean",
            "title": "Anonymiser",
            "default": true
          },
          "noms": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "maxItems": 50,
            "title": "Noms",
            "description": "Noms à masquer, en plus des motifs détectés automatiquement."
          },
          "lieux": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "maxItems": 50,
            "title": "Lieux",
            "description": "Lieux à masquer, en plus des motifs détectés automatiquement."
          },
          "source": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ],
            "title": "Source",
            "description": "Par exemple ligne_verte, application, chatbot."
          },
          "canal": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ],
            "title": "Canal",
            "description": "telephone, whatsapp, web, ussd, api…"
          },
          "zone": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ],
            "title": "Zone",
            "description": "Code de zone, par exemple BJ-LI."
          },
          "external_id": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ],
            "title": "External Id",
            "description": "Identifiant de l'interaction chez la source."
          },
          "recu_le": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ],
            "title": "Recu Le",
            "description": "Date ISO 8601 de l'interaction (défaut : maintenant)."
          }
        },
        "type": "object",
        "required": [
          "texte",
          "langue",
          "consentement"
        ],
        "title": "DemandeAnalyse"
      },
      "DemandeTraduction": {
        "properties": {
          "texte": {
            "type": "string",
            "maxLength": 600,
            "title": "Texte"
          },
          "source": {
            "type": "string",
            "title": "Source"
          },
          "cible": {
            "type": "string",
            "title": "Cible"
          }
        },
        "type": "object",
        "required": [
          "texte",
          "source",
          "cible"
        ],
        "title": "DemandeTraduction"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "CleApi": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "Clé fournie par EnariLab sur invitation."
      }
    }
  }
}
