{
  "info": {
    "title": "LexOpti API",
    "version": "1.0.0",
    "description": "The public API of LexOpti, the anti-money laundering (AML/KYC) compliance platform for French regulated professionals, such as lawyers, notaries, accountants or estate agents. Business terms are explained in the [glossary](https://developers.lexopti.com/glossary/). A partner application acts for one member in one organization, with that member's rights (OAuth 2.1, authorization code with PKCE). Versioned by path: `/v1` only changes additively; a removal is announced with `Deprecation` and `Sunset` headers 12 months ahead.",
    "contact": {
      "name": "LexOpti",
      "email": "contact@lexopti.com",
      "url": "https://developers.lexopti.com"
    },
    "termsOfService": "https://developers.lexopti.com/terms"
  },
  "servers": [
    {
      "url": "https://app.lexopti.com/v1",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Organization",
      "description": "The organization the token is bound to, its members, its usage, deep links."
    },
    {
      "name": "Firms",
      "description": "Organizations of new customers, which your application prepares for their managers to claim, with its own token (client credentials). The API calls them firms."
    },
    {
      "name": "Clients",
      "description": "Persons and companies the organization has a business relationship with."
    },
    {
      "name": "Checks",
      "description": "Screenings of a client across the sources, followed as one unit."
    },
    {
      "name": "Cases",
      "description": "Matters of one or more clients."
    },
    {
      "name": "Alerts",
      "description": "Changes in a source about a monitored client, until a member reviews them."
    },
    {
      "name": "Events",
      "description": "What happened, for polling integrations."
    },
    {
      "name": "Webhooks",
      "description": "Endpoints receiving the events, signed as Standard Webhooks."
    },
    {
      "name": "Embedded UI",
      "description": "Sessions of the embedded components on a partner page."
    },
    {
      "name": "Sandbox",
      "description": "Test triggers of a sandbox organization: events as in production, on demand."
    }
  ],
  "components": {
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "description": "A member authorizes the application for one of their organizations. Access tokens live 15 minutes; refresh tokens rotate (`offline_access`).",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://app.lexopti.com/api/auth/oauth2/authorize",
            "tokenUrl": "https://app.lexopti.com/api/auth/oauth2/token",
            "refreshUrl": "https://app.lexopti.com/api/auth/oauth2/token",
            "scopes": {
              "lexopti:read": "Read the organization's clients, checks, cases, alerts and events.",
              "lexopti:write": "Create clients, launch checks, review alerts, manage webhooks.",
              "offline_access": "Keep access with a refresh token.",
              "openid": "Identify the member.",
              "email": "Read the member's e-mail address."
            }
          }
        }
      },
      "oauth2Application": {
        "type": "oauth2",
        "description": "Your application's own token, for the organizations it prepares for their managers (`/v1/firms`): client credentials with your client secret, `resource` the API, scope `lexopti:firms`. Only for an application approved for production. Tokens live 15 minutes, without refresh token: ask for a new one.",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://app.lexopti.com/api/auth/oauth2/token",
            "scopes": {
              "lexopti:firms": "Prepare organizations for their managers to claim, and follow them."
            }
          }
        }
      }
    },
    "schemas": {
      "Alert": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The alert's LexOpti id."
          },
          "client_id": {
            "type": "string",
            "description": "The client the alert is about."
          },
          "case_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The case, when the alert is about one of its parties; null otherwise."
          },
          "entity_id": {
            "type": "string",
            "description": "The person or company concerned."
          },
          "source": {
            "anyOf": [
              {
                "enum": [
                  "international_sanctions",
                  "eu_sanctions",
                  "french_asset_freezes",
                  "politically_exposed_persons",
                  "high_risk_countries",
                  "bodacc_announcements",
                  "bodacc_insolvency",
                  "company_register",
                  "adverse_media"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The kind of source that changed; null when unknown."
          },
          "status": {
            "enum": [
              "pending",
              "reviewed",
              "dismissed",
              "confirmed"
            ],
            "type": "string",
            "description": "`pending` until reviewed; `reviewed` (noted), `dismissed` (not relevant) or `confirmed` (risk confirmed)."
          },
          "level": {
            "enum": [
              "simplified",
              "standard",
              "enhanced"
            ],
            "type": "string",
            "description": "Vigilance level LexOpti derives from the check results: `simplified` (lighter checks), `standard` or `enhanced` (closer checks). It is not the professional's decision, which is `risk_level`. [Glossary](https://developers.lexopti.com/glossary/)."
          },
          "change": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "What changed: `new` (a new match), `new_source` (another source names the same person), `modified` (a new sanction in a known source), `requalified` (a source changed how it classifies the person), `reopened` (a match set aside matches again), `merged` or `folded` (another record turned out to be the same person); null when unknown."
          },
          "subject": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Who the source names."
          },
          "detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The details the source gives about the change."
          },
          "source_name": {
            "type": "string",
            "description": "The list or register, as it names itself."
          },
          "url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "A link to the source's record, when it gives one."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601, UTC)."
          },
          "reviewed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When a member reviewed it; null while `pending`."
          },
          "review_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The member's note on the review, if any."
          }
        },
        "required": [
          "id",
          "client_id",
          "case_id",
          "entity_id",
          "source",
          "status",
          "level",
          "change",
          "subject",
          "detail",
          "source_name",
          "url",
          "created_at",
          "reviewed_at",
          "review_notes"
        ]
      },
      "Case": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The case's LexOpti id."
          },
          "external_ref": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                "description": "Your own id for the record, e.g. `crm:contact:1042`: 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique per application, organization and kind (client or case). An opaque technical id, never personal data (no name, birth date, e-mail…). Visible to your application only."
              },
              {
                "type": "null"
              }
            ],
            "description": "Your application's reference for the case, null when it has none. Another application's reference is never shown."
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The case's title, as LexOpti shows it."
          },
          "type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The kind of matter, as the profession's policy names it: the first of `types`."
          },
          "types": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Every nature of the case, the first being `type` (a case may have several, as LexOpti's screen picks them)."
          },
          "type_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Free-form nature, when `type` is `custom`."
          },
          "status": {
            "enum": [
              "pending",
              "running",
              "completed",
              "failed"
            ],
            "type": "string",
            "description": "Where the case's own launch stands (`launch_checks` at creation, `POST /v1/cases/{id}/checks`, or the « Lancer les analyses » button in LexOpti): `pending` (none launched yet), `running` (in progress), `completed` (every source answered) or `failed` (a source could not be screened). A check charged to the case by `POST /v1/checks` with `case_id` has its own status and does not change this one: read `pending_alert_count` and the checks for the clients' results."
          },
          "client_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The main client."
          },
          "client_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Every client of the case, the main one first."
          },
          "clients": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "The client's LexOpti id."
                },
                "external_ref": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                      "description": "Your own id for the record, e.g. `crm:contact:1042`: 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique per application, organization and kind (client or case). An opaque technical id, never personal data (no name, birth date, e-mail…). Visible to your application only."
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Your application's reference for the client, null when it has none."
                },
                "main": {
                  "type": "boolean",
                  "description": "The case's main client."
                }
              },
              "required": [
                "id",
                "external_ref",
                "main"
              ]
            },
            "description": "Every client of the case, the main one first, with your references."
          },
          "parties": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "The party's id in this case (another case gives the same person or company another id; `entity_id` stays the same)."
                },
                "entity_id": {
                  "type": "string",
                  "description": "The person or company: the same in every case it is a party of."
                },
                "external_ref": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                      "description": "Your own id for the record, e.g. `crm:contact:1042`: 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique per application, organization and kind (client or case). An opaque technical id, never personal data (no name, birth date, e-mail…). Visible to your application only."
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Your application's reference of the person or company (a contact of your software who is not a client), the same in every case it is a party of; null when you set none."
                },
                "role": {
                  "enum": [
                    "demandeur",
                    "defendeur",
                    "appelant",
                    "intime",
                    "intervenant",
                    "partie_adverse",
                    "vendeur",
                    "acquereur",
                    "cedant",
                    "cessionnaire",
                    "contrepartie",
                    "bailleur",
                    "locataire",
                    "preteur",
                    "emprunteur",
                    "caution",
                    "tiers_payeur",
                    "donateur",
                    "donataire",
                    "heritier_legataire",
                    "mandant",
                    "mandataire",
                    "representant_legal",
                    "intermediaire",
                    "associe",
                    "constituant",
                    "fiduciaire",
                    "beneficiaire",
                    "tiers",
                    "autre"
                  ],
                  "type": "string",
                  "description": "The party's role in the case, a stable code in French (`vendeur`: seller, `acquereur`: buyer, `tiers_payeur`: third-party payer…). Each profession offers its own subset; a role it no longer offers still shows on an older party. New roles may be added: show an unknown one as `autre`."
                },
                "type": {
                  "enum": [
                    "person",
                    "company"
                  ],
                  "type": "string",
                  "description": "`person` or `company`."
                },
                "name": {
                  "type": "string",
                  "description": "Display name."
                },
                "monitoring_enabled": {
                  "type": "boolean",
                  "description": "Ongoing vigilance: the party is screened again as sources change."
                }
              },
              "required": [
                "id",
                "entity_id",
                "external_ref",
                "role",
                "type",
                "name",
                "monitoring_enabled"
              ],
              "description": "A party of the case that is not one of its clients (the other side, a funder…), with its role."
            },
            "description": "The other parties of the case, with their roles."
          },
          "transaction_amount": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The transaction's amount, as a member entered it in LexOpti: free text, without a fixed unit or format. Null when not given."
          },
          "monitoring_enabled": {
            "type": "boolean",
            "description": "Ongoing vigilance: the case is screened again as sources change."
          },
          "vigilance_level": {
            "anyOf": [
              {
                "enum": [
                  "simplified",
                  "standard",
                  "enhanced"
                ],
                "type": "string",
                "description": "Vigilance level LexOpti derives from the check results: `simplified` (lighter checks), `standard` or `enhanced` (closer checks). It is not the professional's decision, which is `risk_level`. [Glossary](https://developers.lexopti.com/glossary/)."
              },
              {
                "type": "null"
              }
            ],
            "description": "Vigilance level LexOpti derives from the case's check results: `simplified` (lighter checks), `standard` or `enhanced` (closer checks). Null until the case's first check. It is not the professional's decision, which is `risk_level`."
          },
          "risk_level": {
            "anyOf": [
              {
                "enum": [
                  "simplified",
                  "standard",
                  "enhanced"
                ],
                "type": "string",
                "description": "Vigilance level LexOpti derives from the check results: `simplified` (lighter checks), `standard` or `enhanced` (closer checks). It is not the professional's decision, which is `risk_level`. [Glossary](https://developers.lexopti.com/glossary/)."
              },
              {
                "type": "null"
              }
            ],
            "description": "Risk level of the case, validated by the professional in LexOpti and computed without the suspicion elements, which stay confidential. `null` until they set it. Read-only: the API cannot change it."
          },
          "classification_state": {
            "enum": [
              "to_complete",
              "in_progress",
              "validated",
              "revalidate"
            ],
            "type": "string",
            "description": "Where the case's classification stands; read it with `GET /v1/cases/{id}/classification`."
          },
          "has_pending_alert": {
            "type": "boolean",
            "description": "At least one alert awaits a member's review."
          },
          "pending_alert_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Alerts awaiting a member's review, as the case page shows them: those of every client of the case and of its parties."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601, UTC)."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601, UTC)."
          }
        },
        "required": [
          "id",
          "external_ref",
          "label",
          "type",
          "types",
          "type_label",
          "status",
          "client_id",
          "client_ids",
          "clients",
          "parties",
          "transaction_amount",
          "monitoring_enabled",
          "vigilance_level",
          "risk_level",
          "classification_state",
          "has_pending_alert",
          "pending_alert_count",
          "created_at",
          "updated_at"
        ]
      },
      "Check": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The check's LexOpti id."
          },
          "client_id": {
            "type": "string",
            "description": "The client screened."
          },
          "status": {
            "enum": [
              "running",
              "completed",
              "failed"
            ],
            "type": "string",
            "description": "`running` until every source answered; `failed` when one of them could not be screened."
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "source": {
                  "enum": [
                    "international_sanctions",
                    "eu_sanctions",
                    "french_asset_freezes",
                    "politically_exposed_persons",
                    "high_risk_countries",
                    "bodacc_announcements",
                    "bodacc_insolvency",
                    "company_register",
                    "adverse_media"
                  ],
                  "type": "string"
                },
                "entity_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The person or company screened: the client or a related party."
                },
                "status": {
                  "enum": [
                    "pending",
                    "running",
                    "completed",
                    "failed",
                    "skipped"
                  ],
                  "type": "string"
                },
                "completed_at": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "source",
                "entity_id",
                "status",
                "completed_at"
              ]
            },
            "description": "One entry per source and screened entity. Empty when nothing needed screening."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601, UTC)."
          },
          "completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When every source answered (`completed` or `failed`); null while `running`."
          }
        },
        "required": [
          "id",
          "client_id",
          "status",
          "sources",
          "created_at",
          "completed_at"
        ]
      },
      "Classification": {
        "type": "object",
        "properties": {
          "subject": {
            "enum": [
              "client",
              "case"
            ],
            "type": "string",
            "description": "`client`: the client's own risk assessment (the questions about the client and the people linked to it, `axe2`); `case`: the case's, every axis, its clients' `axe2` answers included."
          },
          "client_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The client, for `subject: client`; else null."
          },
          "case_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The case, for `subject: case`; else null."
          },
          "state": {
            "enum": [
              "to_complete",
              "in_progress",
              "validated",
              "revalidate"
            ],
            "type": "string",
            "description": "`to_complete`: nothing answered yet; `in_progress`: answers saved, not validated; `validated`; `revalidate`: validated, but the analyses, the persons or the answers changed since, so a member should validate it again."
          },
          "policy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "version": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "id",
              "version"
            ],
            "description": "The questionnaire version the organization's profession uses, such as `lawyer-cnb-asr-2023` for lawyers. An opaque id: compare it, do not parse it."
          },
          "score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Risk score from 0 to 4, as LexOpti computes it from the saved answers; null while nothing scores."
          },
          "level": {
            "anyOf": [
              {
                "enum": [
                  "simplified",
                  "standard",
                  "enhanced"
                ],
                "type": "string",
                "description": "Vigilance level LexOpti derives from the check results: `simplified` (lighter checks), `standard` or `enhanced` (closer checks). It is not the professional's decision, which is `risk_level`. [Glossary](https://developers.lexopti.com/glossary/)."
              },
              {
                "type": "null"
              }
            ],
            "description": "Vigilance level the score gives: `simplified`, `standard` or `enhanced`; null while nothing is answered."
          },
          "validated_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "The last validation by a member; null until the first."
          },
          "validated_by": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "user_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The member who validated; null when no longer known."
                  },
                  "channel": {
                    "anyOf": [
                      {
                        "enum": [
                          "app",
                          "embed",
                          "api",
                          "mcp"
                        ],
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Where: `app` (LexOpti) or `embed` (its screens embedded in a partner application); null when no longer known."
                  }
                },
                "required": [
                  "user_id",
                  "channel"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Who made the last validation; null until the first."
          },
          "answers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "question_id": {
                  "type": "string",
                  "description": "The question's id in the questionnaire (`q2`, `q10_p`…), stable within a `policy`."
                },
                "axis": {
                  "type": "string",
                  "description": "The questionnaire axis (section) the question belongs to: `axe1` (how the relationship started), `axe2` (the client and the people linked to it), `axe3` (the service provided), `axe4` (the transaction). The fifth axis, suspicion, is never returned. [Glossary](https://developers.lexopti.com/glossary/)."
                },
                "value": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The answer: `yes` or `no` for a yes/no question; otherwise the option's value, an ISO 3166-1 alpha-2 code, comma-separated values for a multiple choice, or the text entered. Null when only `per_entity` is answered."
                },
                "linked_entity_ids": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "The persons a risk answer concerns, among the client and its related parties."
                },
                "per_entity": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "entity_id": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string",
                        "description": "Same values as `value`."
                      }
                    },
                    "required": [
                      "entity_id",
                      "value"
                    ]
                  },
                  "description": "A question answered person by person: one entry each."
                }
              },
              "required": [
                "question_id",
                "axis",
                "value",
                "linked_entity_ids",
                "per_entity"
              ]
            },
            "description": "The saved answers, in the questionnaire's order. Prefill proposals a member has not saved are not answers."
          },
          "excluded_axes": {
            "type": "array",
            "items": {
              "enum": [
                "axe5"
              ],
              "type": "string"
            },
            "description": "Axes the API never returns: `axe5`, suspicion (what the professional knows or suspects about the client). French law forbids disclosing it (art. L. 561-18 of the Monetary and Financial Code): neither its answers nor its effect on the score and the level leave LexOpti, and `missing_answers` does not count it. The member sees it in LexOpti and in the embedded components."
          },
          "missing_answers": {
            "type": "object",
            "properties": {
              "count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "question_ids": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "count",
              "question_ids"
            ],
            "description": "The questions still unanswered, as the classification form counts them for these answers and these persons."
          }
        },
        "required": [
          "subject",
          "client_id",
          "case_id",
          "state",
          "policy",
          "score",
          "level",
          "validated_at",
          "validated_by",
          "answers",
          "excluded_axes",
          "missing_answers"
        ]
      },
      "Client": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The client's LexOpti id."
          },
          "external_ref": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                "description": "Your own id for the record, e.g. `crm:contact:1042`: 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique per application, organization and kind (client or case). An opaque technical id, never personal data (no name, birth date, e-mail…). Visible to your application only."
              },
              {
                "type": "null"
              }
            ],
            "description": "Your application's reference for the record, null when it has none. Another application's reference is never shown."
          },
          "type": {
            "enum": [
              "person",
              "company"
            ],
            "type": "string",
            "description": "`person` or `company`."
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "person": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "first_name": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "First name(s)."
                  },
                  "last_name": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Last name."
                  },
                  "usage_name": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The name the person uses, such as a married name."
                  },
                  "birth_date": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Date of birth, `YYYY-MM-DD`."
                  },
                  "birth_city": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "City of birth."
                  },
                  "birth_country": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Country of birth, ISO 3166-1 alpha-2 code."
                  },
                  "nationalities": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Nationalities, ISO 3166-1 alpha-2 codes; empty when unknown."
                  }
                },
                "required": [
                  "first_name",
                  "last_name",
                  "usage_name",
                  "birth_date",
                  "birth_city",
                  "birth_country",
                  "nationalities"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "The identity, with `type: person`; null otherwise."
          },
          "company": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Registered name."
                  },
                  "siren": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "SIREN, nine digits."
                  },
                  "siret": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "SIRET, 14 digits."
                  },
                  "legal_form": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Legal form."
                  },
                  "registration_country": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Country of registration, ISO 3166-1 alpha-2 code."
                  },
                  "rcs": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Trade and companies register (RCS) entry."
                  }
                },
                "required": [
                  "name",
                  "siren",
                  "siret",
                  "legal_form",
                  "registration_country",
                  "rcs"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "The identity, with `type: company`; null otherwise."
          },
          "address": {
            "type": "object",
            "properties": {
              "line": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Number, street and any complement."
              },
              "postal_code": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Postal code."
              },
              "city": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "City."
              },
              "country": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "ISO 3166-1 alpha-2 code."
              }
            },
            "required": [
              "line",
              "postal_code",
              "city",
              "country"
            ],
            "description": "The postal address; each field is null when unknown."
          },
          "monitoring_enabled": {
            "type": "boolean",
            "description": "Ongoing vigilance: the client is screened again as sources change."
          },
          "vigilance_level": {
            "anyOf": [
              {
                "enum": [
                  "simplified",
                  "standard",
                  "enhanced"
                ],
                "type": "string",
                "description": "Vigilance level LexOpti derives from the check results: `simplified` (lighter checks), `standard` or `enhanced` (closer checks). It is not the professional's decision, which is `risk_level`. [Glossary](https://developers.lexopti.com/glossary/)."
              },
              {
                "type": "null"
              }
            ],
            "description": "Vigilance level LexOpti derives from the client's check results: `simplified` (lighter checks), `standard` or `enhanced` (closer checks). Null until the client's first check. It is not the professional's decision, which is `risk_level`."
          },
          "risk_level": {
            "anyOf": [
              {
                "enum": [
                  "simplified",
                  "standard",
                  "enhanced"
                ],
                "type": "string",
                "description": "Vigilance level LexOpti derives from the check results: `simplified` (lighter checks), `standard` or `enhanced` (closer checks). It is not the professional's decision, which is `risk_level`. [Glossary](https://developers.lexopti.com/glossary/)."
              },
              {
                "type": "null"
              }
            ],
            "description": "Risk level the professional decided in LexOpti. `null` until they set it. Read-only: the API cannot change it."
          },
          "has_pending_alert": {
            "type": "boolean",
            "description": "An alert about the client awaits a member's review (`GET /v1/alerts?client_id=&status=pending`)."
          },
          "preliminary_screening": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "status": {
                    "enum": [
                      "pending",
                      "completed",
                      "failed",
                      "unavailable"
                    ],
                    "type": "string",
                    "description": "The status of the latest request. A `pending`, `failed` or `unavailable` request does not replace the current result: `outcome`, `match_count`, `screened_at` and `checked_at` stay those of the latest completed search."
                  },
                  "pending": {
                    "type": "boolean",
                    "description": "A newer request is being screened (`status` is `pending`): the current result may change shortly."
                  },
                  "outcome": {
                    "anyOf": [
                      {
                        "enum": [
                          "no_match",
                          "possible_match"
                        ],
                        "type": "string",
                        "description": "`no_match`: no match in the lists searched, at the versions stated (never a statement that the client is compliant or not frozen); `possible_match`: at least one listed person or entity may be the client, to verify."
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The outcome of the current result (the latest completed search); null while the client has none."
                  },
                  "match_count": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Possible matches of the current result, probable namesakes (a contradicting birth date) left out; null while the client has no completed search."
                  },
                  "screened_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "When the current result's search ran; null while the client has none. A re-screen that found the same matches keeps it and moves `checked_at`."
                  },
                  "checked_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Last time the current result was confirmed against a publication of the lists; null while the client has none."
                  },
                  "last_error": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "The latest request's error code when it is `failed` or `unavailable`, null otherwise. Why it is `failed` or `unavailable`: `unscreenable_subject` (no name or identifier to search), `saturated` (too many candidates to declare the client clear), `lists_not_indexed` (the lists are not searchable yet), `yente_unavailable` (the search service did not answer), `screening_timeout` (the search could not run in time), `sandbox_error` (the sandbox's `ERREUR`). New codes may be added."
                  }
                },
                "required": [
                  "status",
                  "pending",
                  "outcome",
                  "match_count",
                  "screened_at",
                  "checked_at",
                  "last_error"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "The client's free preliminary screening against the official freeze and sanctions lists: the latest request's status and the current result (`GET /v1/clients/{id}/preliminary-screening` for their detail); null when it has none (a client your application did not create through the API is screened when it asks: `POST /v1/clients/{id}/preliminary-screening`)."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601, UTC)."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601, UTC)."
          },
          "last_check": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "status": {
                    "enum": [
                      "running",
                      "completed",
                      "failed"
                    ],
                    "type": "string",
                    "description": "As the check's own `status`."
                  },
                  "created_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "completed_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "status",
                  "created_at",
                  "completed_at"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "With `expand[]=last_check`: the client's latest check (`GET /v1/checks`), null when none was launched."
          },
          "open_alerts_count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "With `expand[]=open_alerts_count`: how many of the client's alerts await a member's review, those of its cases included, as `GET /v1/alerts?client_id=&status=pending` counts them."
          },
          "classification_state": {
            "enum": [
              "to_complete",
              "in_progress",
              "validated",
              "revalidate"
            ],
            "type": "string",
            "description": "With `expand[]=classification_state`: where the client's own classification stands, as `GET /v1/clients/{id}/classification` says it."
          },
          "cases": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "label": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "external_ref": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                          "description": "Your own id for the record, e.g. `crm:contact:1042`: 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique per application, organization and kind (client or case). An opaque technical id, never personal data (no name, birth date, e-mail…). Visible to your application only."
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Your application's reference for the case, null when it has none."
                    },
                    "risk_level": {
                      "anyOf": [
                        {
                          "enum": [
                            "simplified",
                            "standard",
                            "enhanced"
                          ],
                          "type": "string",
                          "description": "Vigilance level LexOpti derives from the check results: `simplified` (lighter checks), `standard` or `enhanced` (closer checks). It is not the professional's decision, which is `risk_level`. [Glossary](https://developers.lexopti.com/glossary/)."
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Risk level of the case, validated by the professional in LexOpti and computed without the suspicion elements, which stay confidential. `null` until they set it. Read-only: the API cannot change it."
                    },
                    "classification_state": {
                      "enum": [
                        "to_complete",
                        "in_progress",
                        "validated",
                        "revalidate"
                      ],
                      "type": "string",
                      "description": "`to_complete`: nothing answered yet; `in_progress`: answers saved, not validated; `validated`; `revalidate`: validated, but the analyses, the persons or the answers changed since, so a member should validate it again."
                    }
                  },
                  "required": [
                    "id",
                    "label",
                    "external_ref",
                    "risk_level",
                    "classification_state"
                  ]
                }
              },
              "has_more": {
                "type": "boolean",
                "description": "More cases exist: list them with `GET /v1/cases?client_id=`."
              }
            },
            "required": [
              "data",
              "has_more"
            ],
            "description": "With `expand[]=cases`: the client's 10 latest cases, main client or not, newest first."
          }
        },
        "required": [
          "id",
          "external_ref",
          "type",
          "name",
          "person",
          "company",
          "address",
          "monitoring_enabled",
          "vigilance_level",
          "risk_level",
          "has_pending_alert",
          "preliminary_screening",
          "created_at",
          "updated_at"
        ]
      },
      "Event": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique per event; the `webhook-id` header of its deliveries."
          },
          "position": {
            "type": "string",
            "pattern": "^\\d+\\.\\d+$",
            "description": "Opaque position in the organization's stream; pass the last one you read as `after`."
          },
          "type": {
            "x-extensible-enum": [
              "check.completed",
              "check.failed",
              "client.created",
              "client.updated",
              "client.vigilance_level_changed",
              "client.risk_level_changed",
              "client.preliminary_screening_completed",
              "classification.validated",
              "case.created",
              "case.updated",
              "case.risk_level_changed",
              "report.generated",
              "alert.created",
              "alert.resolved",
              "decision.pending",
              "quota.exhausted",
              "subscription.inactive",
              "access.revoked",
              "member.enrolled",
              "member.joined"
            ],
            "type": "string",
            "description": "One of the catalog's event types (the `webhooks` section of this document). New types may be added: ignore those you do not handle."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "When it happened (ISO 8601, UTC)."
          },
          "livemode": {
            "type": "boolean",
            "description": "False for an event of a sandbox organization: fixture data, never a real screening."
          },
          "data": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            },
            "description": "Ids of the resources concerned (`client_id`, `case_id`, `check_id`, `alert_id`…), the event's own keys (`subject`, `changed_fields`, `kind`, `reason`… each type documents its own), and your application's references of the client and the case (`client_external_ref`, `case_external_ref`) when it set them. Ids and names only: never personal data, never the suspicion axis."
          }
        },
        "required": [
          "id",
          "position",
          "type",
          "timestamp",
          "livemode",
          "data"
        ]
      },
      "Problem": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "description": "Documentation of the error code."
          },
          "title": {
            "type": "string",
            "description": "The HTTP status phrase."
          },
          "status": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "The HTTP status code."
          },
          "code": {
            "type": "string",
            "description": "Stable machine-readable reason, in English (`not_found`, `validation_failed`…)."
          },
          "detail": {
            "type": "string",
            "description": "Human-readable explanation; may change, never parse it."
          },
          "request_id": {
            "type": "string",
            "description": "The request's id, also its `Request-Id` header: quote it to LexOpti support."
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string",
                  "description": "JSON pointer of the invalid field."
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "path",
                "message"
              ]
            },
            "description": "Invalid fields, for `validation_failed`."
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "entity_id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "is_main_entity": {
                  "type": "boolean"
                },
                "fields": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "entity_id",
                "name",
                "is_main_entity",
                "fields"
              ]
            },
            "description": "Identity fields to complete, for `incomplete_identity`."
          },
          "cases": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "name"
              ]
            },
            "description": "The client's open cases the check can be charged to, for `dossier_required`: send one as `case_id` (empty: create a case first)."
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "code",
          "detail",
          "request_id"
        ]
      },
      "WebhookDelivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The delivery's LexOpti id."
          },
          "event_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The event, the `webhook-id` header; null for a test delivery."
          },
          "type": {
            "type": "string",
            "description": "The event type, or `webhook.test`."
          },
          "status": {
            "enum": [
              "pending",
              "succeeded",
              "failed",
              "cancelled"
            ],
            "type": "string",
            "description": "`cancelled`: the application lost its access to the organization (blocked, or no member's consent left); never counted as a failure of the endpoint."
          },
          "attempts": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "How many times LexOpti sent it."
          },
          "next_attempt_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When LexOpti sends it again; null when it will not."
          },
          "last_attempt_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When LexOpti last sent it; null before the first attempt."
          },
          "last_response_status": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ],
            "description": "The HTTP status your endpoint answered last; null when it did not answer."
          },
          "last_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why the last attempt failed, such as `timeout`; null when it did not fail."
          },
          "replay_of": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The delivery this one replays (`POST …/deliveries/{delivery_id}/replay`); null for an original."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601, UTC)."
          },
          "completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it succeeded or gave up; null while `pending`."
          }
        },
        "required": [
          "id",
          "event_id",
          "type",
          "status",
          "attempts",
          "next_attempt_at",
          "last_attempt_at",
          "last_response_status",
          "last_error",
          "replay_of",
          "created_at",
          "completed_at"
        ]
      },
      "WebhookEndpoint": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The endpoint's LexOpti id."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Where LexOpti sends the events."
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Your label for the endpoint."
          },
          "event_types": {
            "type": "array",
            "items": {
              "x-extensible-enum": [
                "check.completed",
                "check.failed",
                "client.created",
                "client.updated",
                "client.vigilance_level_changed",
                "client.risk_level_changed",
                "client.preliminary_screening_completed",
                "classification.validated",
                "case.created",
                "case.updated",
                "case.risk_level_changed",
                "report.generated",
                "alert.created",
                "alert.resolved",
                "decision.pending",
                "quota.exhausted",
                "subscription.inactive",
                "access.revoked",
                "member.enrolled",
                "member.joined"
              ],
              "type": "string",
              "description": "One of the catalog's event types (the `webhooks` section of this document). New types may be added: ignore those you do not handle."
            },
            "description": "The event types it receives."
          },
          "status": {
            "enum": [
              "enabled",
              "disabled"
            ],
            "type": "string",
            "description": "`disabled`: LexOpti sends nothing; `disabled_reason` says why."
          },
          "disabled_reason": {
            "anyOf": [
              {
                "x-extensible-enum": [
                  "failing",
                  "member",
                  "access_revoked"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`failing`: every delivery failed for a whole retry schedule (about three days); enable it again once fixed. `member`: disabled with `PATCH`. `access_revoked`: your application lost its access to the organization, told by a last `access.revoked` delivery; enable it again once a member authorized it again."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created (ISO 8601, UTC)."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it last changed (ISO 8601, UTC)."
          }
        },
        "required": [
          "id",
          "url",
          "description",
          "event_types",
          "status",
          "disabled_reason",
          "created_at",
          "updated_at"
        ]
      }
    }
  },
  "openapi": "3.1.1",
  "paths": {
    "/firms": {
      "post": {
        "operationId": "firms.create",
        "summary": "Prepare an organization for its manager",
        "description": "With your application's own token (client credentials, scope `lexopti:firms`), never a member's: prepares the organization of a new customer (a `firm`), which waits for its manager, and LexOpti e-mails them the claim link (`claim_url`, in this answer only). The manager claims it through LexOpti's normal sign-up, where every check runs on what they confirm (profession, terms, trial or payment, e-mail code); only then does the organization exist in LexOpti. Until then nothing can be written into it. Only for an application approved for production. A SIREN already a LexOpti client answers 409 `firm_exists`: ask the organization's manager to invite your user. Requires an `Idempotency-Key`; a retry with it answers the same firm without its link (`claim_url` null): renew the link if you need it.",
        "tags": [
          "Firms"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "^[^\\u0000-\\u001F\\u007F-\\u009F]*$",
                    "description": "The organization's name, as its manager will see it at sign-up."
                  },
                  "siren": {
                    "type": "string",
                    "pattern": "^\\d{9}$",
                    "description": "The organization's SIREN: nine digits with a valid check digit."
                  },
                  "profession": {
                    "enum": [
                      "lawyer",
                      "real_estate",
                      "notary",
                      "accountant",
                      "other_regulated"
                    ],
                    "type": "string",
                    "description": "The organization's regulated profession. Its manager confirms it at sign-up, where LexOpti verifies it as for any organization."
                  },
                  "manager": {
                    "type": "object",
                    "properties": {
                      "email": {
                        "type": "string",
                        "maxLength": 254,
                        "format": "email",
                        "description": "The manager's e-mail address: LexOpti sends them the claim link, and only an account with this address may claim the organization."
                      },
                      "first_name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100,
                        "pattern": "^[^\\u0000-\\u001F\\u007F-\\u009F]*$",
                        "description": "The manager's first name, used in the claim e-mail. Example: `Claire`."
                      },
                      "last_name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100,
                        "pattern": "^[^\\u0000-\\u001F\\u007F-\\u009F]*$",
                        "description": "The manager's last name, used in the claim e-mail. Example: `Martin`."
                      }
                    },
                    "required": [
                      "email"
                    ],
                    "additionalProperties": false,
                    "description": "The person who will claim the organization and become its owner."
                  },
                  "external_ref": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                    "description": "Your own id for the organization (a customer of your software, e.g. `crm:customer:12`): 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique among your organizations still waiting. Never personal data."
                  },
                  "locale": {
                    "enum": [
                      "fr",
                      "en"
                    ],
                    "type": "string",
                    "default": "fr",
                    "description": "The language of the claim e-mail: `fr` unless given."
                  }
                },
                "required": [
                  "name",
                  "siren",
                  "profession",
                  "manager"
                ],
                "additionalProperties": false
              },
              "examples": {
                "an_accounting_firm": {
                  "summary": "An accounting firm",
                  "value": {
                    "name": "Martin Expertise",
                    "siren": "732829320",
                    "profession": "accountant",
                    "manager": {
                      "email": "direction@martin-expertise.example",
                      "first_name": "Claire",
                      "last_name": "Martin"
                    },
                    "external_ref": "crm:customer:12",
                    "locale": "fr"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "`firm_` and 32 hexadecimal characters."
                    },
                    "status": {
                      "enum": [
                        "pending",
                        "claimed",
                        "expired",
                        "voided"
                      ],
                      "type": "string",
                      "description": "`pending`: waiting for its manager; `claimed`: the manager signed up and the organization exists in LexOpti; `expired`: never claimed in time; `voided`: an organization with this SIREN joined LexOpti another way first."
                    },
                    "name": {
                      "type": "string"
                    },
                    "siren": {
                      "type": "string"
                    },
                    "profession": {
                      "enum": [
                        "lawyer",
                        "real_estate",
                        "notary",
                        "accountant",
                        "other_regulated"
                      ],
                      "type": "string"
                    },
                    "external_ref": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                          "description": "Your own id for the organization (a customer of your software, e.g. `crm:customer:12`): 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique among your organizations still waiting. Never personal data."
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Your reference for the organization, null when you gave none."
                    },
                    "claim_url": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uri"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The claim link: single use, only in the answer that issued it (the creation and `POST /v1/firms/{id}/claim-link`), null everywhere else, a retried creation included. Show it to the manager signed in to your software if you wish; LexOpti e-mails it to them. Never send it yourself to anyone else."
                    },
                    "claim_url_expires_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When the current claim link stops working (7 days at most, never past `expires_at`); null once the organization is no longer pending."
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When the prepared organization expires if nobody claimed it (30 days)."
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "claimed_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "activated_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When the claimed organization's offer first ran (its trial or its first payment)."
                    },
                    "organization_id": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The organization its manager created, once claimed: the `id` of `GET /v1/organization` once they authorize your application."
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "name",
                    "siren",
                    "profession",
                    "external_ref",
                    "claim_url",
                    "claim_url_expires_at",
                    "expires_at",
                    "created_at",
                    "claimed_at",
                    "activated_at",
                    "organization_id"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired application token (`invalid_token`): these operations take your application's own token (client credentials), never a member's.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The token lacks `lexopti:firms` (`insufficient_scope`), or the application is not approved for production (`production_access_required`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not one of the organizations your application prepared (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The SIREN is already a LexOpti client (`firm_exists`: ask its manager to invite your user), your application already has an organization pending for this SIREN (`firm_pending`) or this reference (`external_ref_conflict`), it has too many organizations pending (`too_many_pending_firms`, 50).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2Application": [
              "lexopti:firms"
            ]
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Unique key of this request (a UUID): a retry with the same key and body gets the first answer.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\n// Your application's own token: client credentials, scope lexopti:firms.\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_APP_TOKEN ?? \"\" });\n\nconst firm = await lexopti.firms.create({\n\tname: \"Agence du Port\",\n\tsiren: \"732829320\",\n\tprofession: \"real_estate\",\n\tmanager: {\n\t\temail: \"gerante@agence-du-port.example\",\n\t\tfirst_name: \"Claire\",\n\t\tlast_name: \"Martin\",\n\t},\n\texternal_ref: \"crm:agency:12\",\n\tlocale: \"fr\",\n});\n// LexOpti e-mails the claim link to the manager. Keep the firm's id:\n// `claim_url` is answered once, to show to the manager in your software.\nconsole.log(firm.id, firm.status, firm.expires_at);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST \"https://app.lexopti.com/v1/firms\" \\\n  -H \"Authorization: Bearer $LEXOPTI_APP_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n    \"name\": \"Martin Expertise\",\n    \"siren\": \"732829320\",\n    \"profession\": \"accountant\",\n    \"manager\": {\n      \"email\": \"direction@martin-expertise.example\",\n      \"first_name\": \"Claire\",\n      \"last_name\": \"Martin\"\n    },\n    \"external_ref\": \"crm:customer:12\",\n    \"locale\": \"fr\"\n  }'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('POST', 'https://app.lexopti.com/v1/firms', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_APP_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [\n        'name' => 'Martin Expertise',\n        'siren' => '732829320',\n        'profession' => 'accountant',\n        'manager' => [\n            'email' => 'direction@martin-expertise.example',\n            'first_name' => 'Claire',\n            'last_name' => 'Martin',\n        ],\n        'external_ref' => 'crm:customer:12',\n        'locale' => 'fr',\n    ],\n]);"
          }
        ]
      }
    },
    "/firms/{id}": {
      "get": {
        "operationId": "firms.get",
        "summary": "Get a prepared organization",
        "description": "One of the organizations your application prepared (`firm`), with its status: poll it to learn when its manager claimed it, or that it expired or was voided. Never its claim link.",
        "tags": [
          "Firms"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "`firm_` and 32 hexadecimal characters."
                    },
                    "status": {
                      "enum": [
                        "pending",
                        "claimed",
                        "expired",
                        "voided"
                      ],
                      "type": "string",
                      "description": "`pending`: waiting for its manager; `claimed`: the manager signed up and the organization exists in LexOpti; `expired`: never claimed in time; `voided`: an organization with this SIREN joined LexOpti another way first."
                    },
                    "name": {
                      "type": "string"
                    },
                    "siren": {
                      "type": "string"
                    },
                    "profession": {
                      "enum": [
                        "lawyer",
                        "real_estate",
                        "notary",
                        "accountant",
                        "other_regulated"
                      ],
                      "type": "string"
                    },
                    "external_ref": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                          "description": "Your own id for the organization (a customer of your software, e.g. `crm:customer:12`): 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique among your organizations still waiting. Never personal data."
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Your reference for the organization, null when you gave none."
                    },
                    "claim_url": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uri"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The claim link: single use, only in the answer that issued it (the creation and `POST /v1/firms/{id}/claim-link`), null everywhere else, a retried creation included. Show it to the manager signed in to your software if you wish; LexOpti e-mails it to them. Never send it yourself to anyone else."
                    },
                    "claim_url_expires_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When the current claim link stops working (7 days at most, never past `expires_at`); null once the organization is no longer pending."
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When the prepared organization expires if nobody claimed it (30 days)."
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "claimed_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "activated_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When the claimed organization's offer first ran (its trial or its first payment)."
                    },
                    "organization_id": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The organization its manager created, once claimed: the `id` of `GET /v1/organization` once they authorize your application."
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "name",
                    "siren",
                    "profession",
                    "external_ref",
                    "claim_url",
                    "claim_url_expires_at",
                    "expires_at",
                    "created_at",
                    "claimed_at",
                    "activated_at",
                    "organization_id"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired application token (`invalid_token`): these operations take your application's own token (client credentials), never a member's.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The token lacks `lexopti:firms` (`insufficient_scope`), or the application is not approved for production (`production_access_required`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not one of the organizations your application prepared (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2Application": [
              "lexopti:firms"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\n// Your application's own token: client credentials, scope lexopti:firms.\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_APP_TOKEN ?? \"\" });\n\nconst firm = await lexopti.firms.get({\n\tid: \"firm_7d3e9a1c5b2f4e6d8a0c1b3e5f7a9d2c\",\n});\nif (firm.status === \"claimed\") {\n\t// The organization the manager created: the one your OAuth connection names.\n\tconsole.log(firm.organization_id, firm.claimed_at);\n} else {\n\tconsole.log(firm.status, firm.expires_at);\n}"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/firms/:id\" \\\n  -H \"Authorization: Bearer $LEXOPTI_APP_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/firms/:id', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_APP_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/firms/{id}/claim-link": {
      "post": {
        "operationId": "firms.createClaimLink",
        "summary": "Renew a claim link",
        "description": "A new claim link for an organization still pending, e-mailed to its manager again, once a minute at most (429 `rate_limited`): the previous link stops working at once. For a link that expired (7 days) or was lost. 409 `firm_not_pending` once it is claimed, expired or voided.",
        "tags": [
          "Firms"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "`firm_` and 32 hexadecimal characters."
                    },
                    "status": {
                      "enum": [
                        "pending",
                        "claimed",
                        "expired",
                        "voided"
                      ],
                      "type": "string",
                      "description": "`pending`: waiting for its manager; `claimed`: the manager signed up and the organization exists in LexOpti; `expired`: never claimed in time; `voided`: an organization with this SIREN joined LexOpti another way first."
                    },
                    "name": {
                      "type": "string"
                    },
                    "siren": {
                      "type": "string"
                    },
                    "profession": {
                      "enum": [
                        "lawyer",
                        "real_estate",
                        "notary",
                        "accountant",
                        "other_regulated"
                      ],
                      "type": "string"
                    },
                    "external_ref": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                          "description": "Your own id for the organization (a customer of your software, e.g. `crm:customer:12`): 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique among your organizations still waiting. Never personal data."
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Your reference for the organization, null when you gave none."
                    },
                    "claim_url": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uri"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The claim link: single use, only in the answer that issued it (the creation and `POST /v1/firms/{id}/claim-link`), null everywhere else, a retried creation included. Show it to the manager signed in to your software if you wish; LexOpti e-mails it to them. Never send it yourself to anyone else."
                    },
                    "claim_url_expires_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When the current claim link stops working (7 days at most, never past `expires_at`); null once the organization is no longer pending."
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When the prepared organization expires if nobody claimed it (30 days)."
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "claimed_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "activated_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When the claimed organization's offer first ran (its trial or its first payment)."
                    },
                    "organization_id": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The organization its manager created, once claimed: the `id` of `GET /v1/organization` once they authorize your application."
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "name",
                    "siren",
                    "profession",
                    "external_ref",
                    "claim_url",
                    "claim_url_expires_at",
                    "expires_at",
                    "created_at",
                    "claimed_at",
                    "activated_at",
                    "organization_id"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired application token (`invalid_token`): these operations take your application's own token (client credentials), never a member's.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The token lacks `lexopti:firms` (`insufficient_scope`), or the application is not approved for production (`production_access_required`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not one of the organizations your application prepared (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The organization is no longer pending: claimed, expired or voided (`firm_not_pending`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2Application": [
              "lexopti:firms"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\n// Your application's own token: client credentials, scope lexopti:firms.\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_APP_TOKEN ?? \"\" });\n\nconst firm = await lexopti.firms.createClaimLink({\n\tid: \"firm_7d3e9a1c5b2f4e6d8a0c1b3e5f7a9d2c\",\n});\n// The previous link stopped working; this one lasts until claim_url_expires_at.\nconsole.log(firm.status, firm.claim_url_expires_at);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST \"https://app.lexopti.com/v1/firms/:id/claim-link\" \\\n  -H \"Authorization: Bearer $LEXOPTI_APP_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{}'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('POST', 'https://app.lexopti.com/v1/firms/:id/claim-link', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_APP_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [],\n]);"
          }
        ]
      }
    },
    "/embed-sessions": {
      "post": {
        "operationId": "embedSessions.create",
        "summary": "Open an embed session",
        "description": "A one-time code (60 s) for the embedded components, for the member of the access token and a partner page origin registered for the application. Call it from your server; the components exchange the code for their own short-lived token.",
        "tags": [
          "Embedded UI"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code_challenge": {
                    "type": "string",
                    "pattern": "^[\\w-]{43}$",
                    "description": "The PKCE challenge the embedded components handed your page (`sessionProvider`'s `codeChallenge`), passed as is: only the iframe that made it can redeem the code."
                  },
                  "code_challenge_method": {
                    "const": "S256",
                    "description": "Always `S256` (`sessionProvider`'s `codeChallengeMethod`)."
                  },
                  "component": {
                    "enum": [
                      "app",
                      "client",
                      "case",
                      "clients",
                      "cases",
                      "new-client",
                      "new-case",
                      "classification"
                    ],
                    "type": "string",
                    "description": "The component the session opens (`sessionProvider`'s `component`), passed as is. Available: `client`, `case`, `clients`, `cases`, `app`, `new-client`, `new-case` and `classification` (a client's or a case's questionnaire, bare)."
                  },
                  "features": {
                    "type": "array",
                    "maxItems": 16,
                    "items": {
                      "type": "string",
                      "maxLength": 32
                    },
                    "description": "The parts of the component to keep, all of them when omitted; the member's rights still apply. `client` and `clients`: `monitoring`, `cases`, `classification`, `informations`, `comments`, `activity`, `launch-check`, `edit`. `case` and `cases`: `parties`, `tracfin2` (the risk questionnaire), `documents`, `comments`, `activity`, `launch-check`, `edit`. `app`: the tabs of both pages, then `launch-check` and `edit`. `edit` also holds the creation entries of the lists and the dashboard. A key of another component answers `invalid_features`."
                  },
                  "origin": {
                    "type": "string",
                    "description": "Origin of the partner page that embeds the components (`https://crm.example.com`), registered for the application."
                  }
                },
                "required": [
                  "code_challenge",
                  "code_challenge_method",
                  "component",
                  "origin"
                ]
              },
              "examples": {
                "the_client_component": {
                  "summary": "The client component",
                  "value": {
                    "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
                    "code_challenge_method": "S256",
                    "component": "client",
                    "origin": "https://crm.example.com"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "description": "One-time code for the embedded components; hand it to them at once, never store it."
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "60 seconds after issuance."
                    },
                    "integration": {
                      "type": "string",
                      "description": "The application's public id, for the components' `integration` attribute."
                    }
                  },
                  "required": [
                    "code",
                    "expires_at",
                    "integration"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\n// The challenge and the component the element handed your page\n// (sessionProvider), as is.\nconst codeChallenge = \"E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM\";\nconst session = await lexopti.embedSessions.create({\n\tcode_challenge: codeChallenge,\n\tcode_challenge_method: \"S256\",\n\tcomponent: \"client\",\n\torigin: \"https://crm.example.com\",\n});\nconsole.log(session.code, session.integration);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST \"https://app.lexopti.com/v1/embed-sessions\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n    \"code_challenge\": \"E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM\",\n    \"code_challenge_method\": \"S256\",\n    \"component\": \"client\",\n    \"origin\": \"https://crm.example.com\"\n  }'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('POST', 'https://app.lexopti.com/v1/embed-sessions', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [\n        'code_challenge' => 'E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM',\n        'code_challenge_method' => 'S256',\n        'component' => 'client',\n        'origin' => 'https://crm.example.com',\n    ],\n]);"
          }
        ]
      }
    },
    "/events": {
      "get": {
        "operationId": "events.list",
        "summary": "List events",
        "description": "The organization's events, newest first, the same as the webhooks deliver. For polling integrations; deduplicate on `id`.",
        "tags": [
          "Events"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "description": "Page size, 1 to 100."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Page size, 1 to 100."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "`next_cursor` of the previous page; omit for the first page."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "`next_cursor` of the previous page; omit for the first page."
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "x-extensible-enum": [
                "check.completed",
                "check.failed",
                "client.created",
                "client.updated",
                "client.vigilance_level_changed",
                "client.risk_level_changed",
                "client.preliminary_screening_completed",
                "classification.validated",
                "case.created",
                "case.updated",
                "case.risk_level_changed",
                "report.generated",
                "alert.created",
                "alert.resolved",
                "decision.pending",
                "quota.exhausted",
                "subscription.inactive",
                "access.revoked",
                "member.enrolled",
                "member.joined"
              ],
              "type": "string",
              "description": "One of the catalog's event types (the `webhooks` section of this document). New types may be added: ignore those you do not handle."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "One of the catalog's event types (the `webhooks` section of this document). New types may be added: ignore those you do not handle."
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^(?:0|\\d+\\.\\d+)$",
              "description": "Polling: the events after this `position` (`0` from the start), oldest first. Keep the last `position` you read and send it next time: no event can later appear before it, so you miss none. Without it, newest first with `cursor`."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Polling: the events after this `position` (`0` from the start), oldest first. Keep the last `position` you read and send it next time: no event can later appear before it, so you miss none. Without it, newest first with `cursor`."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Event"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Pass it as `cursor` to read the next page; null on the last one."
                    }
                  },
                  "required": [
                    "data",
                    "has_more",
                    "next_cursor"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst page = await lexopti.events.list({ limit: 100 });\nfor (const event of page.data) {\n\tconsole.log(event.position, event.type, event.data);\n}"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/events\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/events', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/alerts": {
      "get": {
        "operationId": "alerts.list",
        "summary": "List alerts",
        "description": "The organization's alerts, newest first.",
        "tags": [
          "Alerts"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "description": "Page size, 1 to 100."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Page size, 1 to 100."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "`next_cursor` of the previous page; omit for the first page."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "`next_cursor` of the previous page; omit for the first page."
          },
          {
            "name": "client_id",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "Only the alerts of this client."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Only the alerts of this client."
          },
          {
            "name": "client_ids",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,64}(?:,[A-Za-z0-9_-]{1,64}){0,99}$",
              "description": "Only the alerts of these clients, by their LexOpti id, comma-separated (at most 100), as `GET /v1/clients?ids=` takes them: one request for the alerts of a page of records. A client of another organization is left out, as an unknown one."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Only the alerts of these clients, by their LexOpti id, comma-separated (at most 100), as `GET /v1/clients?ids=` takes them: one request for the alerts of a page of records. A client of another organization is left out, as an unknown one."
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "enum": [
                "pending",
                "reviewed",
                "dismissed",
                "confirmed"
              ],
              "type": "string",
              "description": "`pending` until reviewed; `reviewed` (noted), `dismissed` (not relevant) or `confirmed` (risk confirmed)."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "`pending` until reviewed; `reviewed` (noted), `dismissed` (not relevant) or `confirmed` (risk confirmed)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Alert"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Pass it as `cursor` to read the next page; null on the last one."
                    }
                  },
                  "required": [
                    "data",
                    "has_more",
                    "next_cursor"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst page = await lexopti.alerts.list({\n\tclient_id: \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\",\n\tstatus: \"pending\",\n\tlimit: 50,\n});\nfor (const alert of page.data) {\n\tconsole.log(alert.id, alert.level, alert.subject);\n}"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/alerts\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/alerts', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/alerts/{id}": {
      "get": {
        "operationId": "alerts.get",
        "summary": "Get an alert",
        "description": "One alert of the organization, with its source and its review.",
        "tags": [
          "Alerts"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Alert"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst alert = await lexopti.alerts.get({\n\tid: \"a3d5f7b9-1c2e-4f60-8a9b-7c6d5e4f3a21\",\n});\nconsole.log(alert.level, alert.source, alert.status);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/alerts/:id\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/alerts/:id', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      },
      "patch": {
        "operationId": "alerts.update",
        "summary": "Review an alert",
        "description": "Records the member's review, as in the app. The decision stays the member's: the API never reviews on its own.",
        "tags": [
          "Alerts"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "enum": [
                      "reviewed",
                      "dismissed",
                      "confirmed"
                    ],
                    "type": "string",
                    "description": "The member's review: `reviewed` (noted), `dismissed` (not relevant, such as a homonym) or `confirmed` (risk confirmed)."
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 2000,
                    "description": "The member's note on the review, shown in LexOpti. 2,000 characters at most."
                  }
                },
                "required": [
                  "status"
                ]
              },
              "examples": {
                "dismiss_a_homonym": {
                  "summary": "Dismiss a homonym",
                  "value": {
                    "status": "dismissed",
                    "notes": "Homonym: different date of birth."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Alert"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst alert = await lexopti.alerts.update({\n\tid: \"a3d5f7b9-1c2e-4f60-8a9b-7c6d5e4f3a21\",\n\tstatus: \"dismissed\",\n\tnotes: \"Homonym: different date of birth.\",\n});\nconsole.log(alert.status, alert.reviewed_at);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X PATCH \"https://app.lexopti.com/v1/alerts/:id\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n    \"status\": \"dismissed\",\n    \"notes\": \"Homonym: different date of birth.\"\n  }'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('PATCH', 'https://app.lexopti.com/v1/alerts/:id', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [\n        'status' => 'dismissed',\n        'notes' => 'Homonym: different date of birth.',\n    ],\n]);"
          }
        ]
      }
    },
    "/cases": {
      "get": {
        "operationId": "cases.list",
        "summary": "List cases",
        "description": "The organization's cases, newest first.",
        "tags": [
          "Cases"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "description": "Page size, 1 to 100."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Page size, 1 to 100."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "`next_cursor` of the previous page; omit for the first page."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "`next_cursor` of the previous page; omit for the first page."
          },
          {
            "name": "external_ref",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9:._-]{1,255}(?:,[A-Za-z0-9:._-]{1,255}){0,99}$",
              "description": "Only the cases with these references of your application, comma-separated (at most 100): `crm:matter:1,crm:matter:2`. An unknown reference is left out; none known gives an empty page."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Only the cases with these references of your application, comma-separated (at most 100): `crm:matter:1,crm:matter:2`. An unknown reference is left out; none known gives an empty page."
          },
          {
            "name": "ids",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,64}(?:,[A-Za-z0-9_-]{1,64}){0,99}$",
              "description": "Only these cases, by their LexOpti id, comma-separated (at most 100). An id of another organization is left out, as an unknown one."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Only these cases, by their LexOpti id, comma-separated (at most 100). An id of another organization is left out, as an unknown one."
          },
          {
            "name": "client_id",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "Only the cases of this client, main or not."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Only the cases of this client, main or not."
          },
          {
            "name": "party_external_ref",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9:._-]{1,255}$",
              "description": "Only the cases this party of yours is in (your reference of the person or company); an unknown reference gives an empty page."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Only the cases this party of yours is in (your reference of the person or company); an unknown reference gives an empty page."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Case"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Pass it as `cursor` to read the next page; null on the last one."
                    }
                  },
                  "required": [
                    "data",
                    "has_more",
                    "next_cursor"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst page = await lexopti.cases.list({\n\tclient_id: \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\",\n});\nconsole.log(page.data.map((dossier) => dossier.label));"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/cases\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/cases', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      },
      "post": {
        "operationId": "cases.create",
        "summary": "Create a case",
        "description": "Creates a case for existing clients, with its natures and its parties, as LexOpti's « Nouveau dossier » screen does (LexOpti calls a case a « dossier »), the member who authorized your application assigned to it. The case is paid as it is created, exactly as the screen charges it: one credit per group of five people or companies, one at least, for twelve months of vigilance (`POST /v1/cases/preview` tells the price first; `quota_exceeded` when the balance cannot pay it, `subscription_inactive` without an offer running, nothing created). Nothing is screened unless `launch_checks`. Sends `case.created`. Requires an `Idempotency-Key`.",
        "tags": [
          "Cases"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clients": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "description": "The client's LexOpti id."
                        },
                        "external_ref": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                          "description": "Or your application's reference of the client."
                        }
                      },
                      "description": "An existing client of the organization, by its id or by your reference (one of them): create a new one first with `POST /v1/clients`."
                    },
                    "description": "The case's clients, the main one first: existing clients of the organization."
                  },
                  "types": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 10,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-z0-9_]{1,64}$"
                    },
                    "description": "The case's natures, among those the organization's profession offers (the portal lists them), or `custom` with `type_label`."
                  },
                  "type_label": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 160,
                    "pattern": "^[^\\u0000-\\u001F\\u007F-\\u009F]*$",
                    "description": "The free-form nature, with `custom` only."
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "^[^\\u0000-\\u001F\\u007F-\\u009F]*$",
                    "description": "The case's title; by default its main client's name."
                  },
                  "parties": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "const": "person",
                              "description": "`person` or `company`: send the matching object, `person` or `company`."
                            },
                            "role": {
                              "enum": [
                                "demandeur",
                                "defendeur",
                                "appelant",
                                "intime",
                                "intervenant",
                                "partie_adverse",
                                "vendeur",
                                "acquereur",
                                "cedant",
                                "cessionnaire",
                                "contrepartie",
                                "bailleur",
                                "locataire",
                                "preteur",
                                "emprunteur",
                                "caution",
                                "tiers_payeur",
                                "donateur",
                                "donataire",
                                "heritier_legataire",
                                "mandant",
                                "mandataire",
                                "representant_legal",
                                "intermediaire",
                                "associe",
                                "constituant",
                                "fiduciaire",
                                "beneficiaire",
                                "tiers",
                                "autre"
                              ],
                              "type": "string",
                              "description": "The party's role in the case, a stable code in French (`vendeur`: seller, `acquereur`: buyer, `tiers_payeur`: third-party payer…). Each profession offers its own subset; a role it no longer offers still shows on an older party. New roles may be added: show an unknown one as `autre`."
                            },
                            "person": {
                              "type": "object",
                              "properties": {
                                "first_name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "First name(s), as on the identity document. Example: `Camille`."
                                },
                                "last_name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "Last name, as on the identity document. Example: `Durand`."
                                },
                                "usage_name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "The name the person uses when it differs from `last_name`, such as a married name (« nom d'usage »). Example: `Martin`."
                                },
                                "birth_date": {
                                  "type": "string",
                                  "format": "date",
                                  "description": "Date of birth, `YYYY-MM-DD`. Needed to launch a check (`incomplete_identity` otherwise). Example: `1980-02-01`."
                                },
                                "birth_city": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "City of birth. Example: `Lyon`."
                                },
                                "birth_country": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z]{2}$",
                                  "description": "Country of birth: ISO 3166-1 alpha-2 code (`FR`, not `France`), upper-cased by LexOpti. Example: `FR`."
                                },
                                "nationalities": {
                                  "type": "array",
                                  "maxItems": 10,
                                  "items": {
                                    "type": "string",
                                    "pattern": "^[A-Za-z]{2}$"
                                  },
                                  "description": "Nationalities: ISO 3166-1 alpha-2 codes (`FR`, not `France`), upper-cased by LexOpti, 10 at most. At least one is needed to launch a check (`incomplete_identity` otherwise): the check compares them with the nationalities on sanctions lists and of politically exposed persons (PEP). Example: `[\"FR\"]`."
                                }
                              },
                              "required": [
                                "first_name",
                                "last_name"
                              ],
                              "description": "The person's identity, with `type: person`."
                            },
                            "address": {
                              "type": "object",
                              "properties": {
                                "line": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "Number, street and any complement. Example: `12 rue de la Paix`."
                                },
                                "postal_code": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "Postal code. Example: `75002`."
                                },
                                "city": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "City. Example: `Paris`."
                                },
                                "country": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z]{2}$",
                                  "description": "Country: ISO 3166-1 alpha-2 code (`FR`, not `France`), upper-cased by LexOpti. Example: `FR`."
                                }
                              },
                              "description": "The postal address. Optional."
                            },
                            "external_ref": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                              "description": "Your reference of the person (a contact of your software who is not a client): a person it already names joins the case instead of a new one, else the new party is linked to it."
                            }
                          },
                          "required": [
                            "type",
                            "role",
                            "person"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "const": "company",
                              "description": "`person` or `company`: send the matching object, `person` or `company`."
                            },
                            "role": {
                              "enum": [
                                "demandeur",
                                "defendeur",
                                "appelant",
                                "intime",
                                "intervenant",
                                "partie_adverse",
                                "vendeur",
                                "acquereur",
                                "cedant",
                                "cessionnaire",
                                "contrepartie",
                                "bailleur",
                                "locataire",
                                "preteur",
                                "emprunteur",
                                "caution",
                                "tiers_payeur",
                                "donateur",
                                "donataire",
                                "heritier_legataire",
                                "mandant",
                                "mandataire",
                                "representant_legal",
                                "intermediaire",
                                "associe",
                                "constituant",
                                "fiduciaire",
                                "beneficiaire",
                                "tiers",
                                "autre"
                              ],
                              "type": "string",
                              "description": "The party's role in the case, a stable code in French (`vendeur`: seller, `acquereur`: buyer, `tiers_payeur`: third-party payer…). Each profession offers its own subset; a role it no longer offers still shows on an older party. New roles may be added: show an unknown one as `autre`."
                            },
                            "company": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "The company's registered name. Example: `Atelier Durand`."
                                },
                                "siren": {
                                  "type": "string",
                                  "pattern": "^\\d{9}$",
                                  "description": "SIREN: nine digits, without spaces. With `registration_country`, needed to launch a check on a French company. Example: `552100554`."
                                },
                                "siret": {
                                  "type": "string",
                                  "pattern": "^\\d{14}$",
                                  "description": "SIRET of one of its establishments: 14 digits, without spaces. Example: `55210055400013`."
                                },
                                "legal_form": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "Legal form, usually its abbreviation. Example: `SAS`."
                                },
                                "registration_country": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z]{2}$",
                                  "description": "Country of registration: ISO 3166-1 alpha-2 code (`FR`, not `France`), upper-cased by LexOpti. Example: `FR`."
                                },
                                "rcs": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "Trade and companies register (RCS) entry, as on the Kbis. Example: `Nice B 552 100 554`."
                                }
                              },
                              "required": [
                                "name"
                              ],
                              "description": "The company's identity, with `type: company`."
                            },
                            "address": {
                              "type": "object",
                              "properties": {
                                "line": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "Number, street and any complement. Example: `12 rue de la Paix`."
                                },
                                "postal_code": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "Postal code. Example: `75002`."
                                },
                                "city": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "City. Example: `Paris`."
                                },
                                "country": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z]{2}$",
                                  "description": "Country: ISO 3166-1 alpha-2 code (`FR`, not `France`), upper-cased by LexOpti. Example: `FR`."
                                }
                              },
                              "description": "The postal address. Optional."
                            },
                            "external_ref": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                              "description": "Your reference of the company: a company it already names joins the case instead of a new one, else the new party is linked to it."
                            }
                          },
                          "required": [
                            "type",
                            "role",
                            "company"
                          ]
                        }
                      ],
                      "description": "A party of the case who is not one of its clients (the other side, a seller, a funder…), with its role among those the organization's profession offers (the portal lists them)."
                    },
                    "description": "The other parties, created with the case: each counts as one person or company in its price."
                  },
                  "external_ref": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                    "description": "Your reference for the new case (a matter, a mandate, an engagement…), linked with its creation: a reference already used answers 409 `external_ref_conflict` and creates nothing."
                  },
                  "launch_checks": {
                    "type": "boolean",
                    "description": "Launch the case's analyses once it is created, as LexOpti's « Lancer les analyses » does, when that costs nothing more than the creation; otherwise (an existing client edited since its last check counts once more) nothing is launched and `analyses_launched` is false. The identities to screen must then be complete (`incomplete_identity`, nothing created)."
                  }
                },
                "required": [
                  "clients",
                  "types"
                ]
              },
              "examples": {
                "a_property_sale_with_a_buyer": {
                  "summary": "A property sale, with a buyer",
                  "value": {
                    "clients": [
                      {
                        "id": "6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10"
                      }
                    ],
                    "types": [
                      "vente_immobiliere"
                    ],
                    "label": "Vente Durand, 12 rue des Lilas",
                    "parties": [
                      {
                        "type": "person",
                        "role": "acquereur",
                        "person": {
                          "first_name": "Léa",
                          "last_name": "Martin",
                          "birth_date": "1988-04-12",
                          "nationalities": [
                            "FR"
                          ]
                        },
                        "external_ref": "crm:contact:2001"
                      }
                    ],
                    "external_ref": "crm:matter:42"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The case's LexOpti id."
                    },
                    "external_ref": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                          "description": "Your own id for the record, e.g. `crm:contact:1042`: 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique per application, organization and kind (client or case). An opaque technical id, never personal data (no name, birth date, e-mail…). Visible to your application only."
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Your application's reference for the case, null when it has none. Another application's reference is never shown."
                    },
                    "label": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The case's title, as LexOpti shows it."
                    },
                    "type": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The kind of matter, as the profession's policy names it: the first of `types`."
                    },
                    "types": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Every nature of the case, the first being `type` (a case may have several, as LexOpti's screen picks them)."
                    },
                    "type_label": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Free-form nature, when `type` is `custom`."
                    },
                    "status": {
                      "enum": [
                        "pending",
                        "running",
                        "completed",
                        "failed"
                      ],
                      "type": "string",
                      "description": "Where the case's own launch stands (`launch_checks` at creation, `POST /v1/cases/{id}/checks`, or the « Lancer les analyses » button in LexOpti): `pending` (none launched yet), `running` (in progress), `completed` (every source answered) or `failed` (a source could not be screened). A check charged to the case by `POST /v1/checks` with `case_id` has its own status and does not change this one: read `pending_alert_count` and the checks for the clients' results."
                    },
                    "client_id": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The main client."
                    },
                    "client_ids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Every client of the case, the main one first."
                    },
                    "clients": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "The client's LexOpti id."
                          },
                          "external_ref": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                                "description": "Your own id for the record, e.g. `crm:contact:1042`: 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique per application, organization and kind (client or case). An opaque technical id, never personal data (no name, birth date, e-mail…). Visible to your application only."
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Your application's reference for the client, null when it has none."
                          },
                          "main": {
                            "type": "boolean",
                            "description": "The case's main client."
                          }
                        },
                        "required": [
                          "id",
                          "external_ref",
                          "main"
                        ]
                      },
                      "description": "Every client of the case, the main one first, with your references."
                    },
                    "parties": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "The party's id in this case (another case gives the same person or company another id; `entity_id` stays the same)."
                          },
                          "entity_id": {
                            "type": "string",
                            "description": "The person or company: the same in every case it is a party of."
                          },
                          "external_ref": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                                "description": "Your own id for the record, e.g. `crm:contact:1042`: 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique per application, organization and kind (client or case). An opaque technical id, never personal data (no name, birth date, e-mail…). Visible to your application only."
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Your application's reference of the person or company (a contact of your software who is not a client), the same in every case it is a party of; null when you set none."
                          },
                          "role": {
                            "enum": [
                              "demandeur",
                              "defendeur",
                              "appelant",
                              "intime",
                              "intervenant",
                              "partie_adverse",
                              "vendeur",
                              "acquereur",
                              "cedant",
                              "cessionnaire",
                              "contrepartie",
                              "bailleur",
                              "locataire",
                              "preteur",
                              "emprunteur",
                              "caution",
                              "tiers_payeur",
                              "donateur",
                              "donataire",
                              "heritier_legataire",
                              "mandant",
                              "mandataire",
                              "representant_legal",
                              "intermediaire",
                              "associe",
                              "constituant",
                              "fiduciaire",
                              "beneficiaire",
                              "tiers",
                              "autre"
                            ],
                            "type": "string",
                            "description": "The party's role in the case, a stable code in French (`vendeur`: seller, `acquereur`: buyer, `tiers_payeur`: third-party payer…). Each profession offers its own subset; a role it no longer offers still shows on an older party. New roles may be added: show an unknown one as `autre`."
                          },
                          "type": {
                            "enum": [
                              "person",
                              "company"
                            ],
                            "type": "string",
                            "description": "`person` or `company`."
                          },
                          "name": {
                            "type": "string",
                            "description": "Display name."
                          },
                          "monitoring_enabled": {
                            "type": "boolean",
                            "description": "Ongoing vigilance: the party is screened again as sources change."
                          }
                        },
                        "required": [
                          "id",
                          "entity_id",
                          "external_ref",
                          "role",
                          "type",
                          "name",
                          "monitoring_enabled"
                        ],
                        "description": "A party of the case that is not one of its clients (the other side, a funder…), with its role."
                      },
                      "description": "The other parties of the case, with their roles."
                    },
                    "transaction_amount": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The transaction's amount, as a member entered it in LexOpti: free text, without a fixed unit or format. Null when not given."
                    },
                    "monitoring_enabled": {
                      "type": "boolean",
                      "description": "Ongoing vigilance: the case is screened again as sources change."
                    },
                    "vigilance_level": {
                      "anyOf": [
                        {
                          "enum": [
                            "simplified",
                            "standard",
                            "enhanced"
                          ],
                          "type": "string",
                          "description": "Vigilance level LexOpti derives from the check results: `simplified` (lighter checks), `standard` or `enhanced` (closer checks). It is not the professional's decision, which is `risk_level`. [Glossary](https://developers.lexopti.com/glossary/)."
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Vigilance level LexOpti derives from the case's check results: `simplified` (lighter checks), `standard` or `enhanced` (closer checks). Null until the case's first check. It is not the professional's decision, which is `risk_level`."
                    },
                    "risk_level": {
                      "anyOf": [
                        {
                          "enum": [
                            "simplified",
                            "standard",
                            "enhanced"
                          ],
                          "type": "string",
                          "description": "Vigilance level LexOpti derives from the check results: `simplified` (lighter checks), `standard` or `enhanced` (closer checks). It is not the professional's decision, which is `risk_level`. [Glossary](https://developers.lexopti.com/glossary/)."
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Risk level of the case, validated by the professional in LexOpti and computed without the suspicion elements, which stay confidential. `null` until they set it. Read-only: the API cannot change it."
                    },
                    "classification_state": {
                      "enum": [
                        "to_complete",
                        "in_progress",
                        "validated",
                        "revalidate"
                      ],
                      "type": "string",
                      "description": "Where the case's classification stands; read it with `GET /v1/cases/{id}/classification`."
                    },
                    "has_pending_alert": {
                      "type": "boolean",
                      "description": "At least one alert awaits a member's review."
                    },
                    "pending_alert_count": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Alerts awaiting a member's review, as the case page shows them: those of every client of the case and of its parties."
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When it was created (ISO 8601, UTC)."
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When it last changed (ISO 8601, UTC)."
                    },
                    "credits_charged": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "The credits the creation spent: opening the case, then its parties (computed, never drawn, in a sandbox)."
                    },
                    "analyses_launched": {
                      "type": "boolean",
                      "description": "Its analyses were launched (`launch_checks`): follow the case's `status`."
                    }
                  },
                  "required": [
                    "id",
                    "external_ref",
                    "label",
                    "type",
                    "types",
                    "type_label",
                    "status",
                    "client_id",
                    "client_ids",
                    "clients",
                    "parties",
                    "transaction_amount",
                    "monitoring_enabled",
                    "vigilance_level",
                    "risk_level",
                    "classification_state",
                    "has_pending_alert",
                    "pending_alert_count",
                    "created_at",
                    "updated_at",
                    "credits_charged",
                    "analyses_launched"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Unique key of this request (a UUID): a retry with the same key and body gets the first answer.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst dossier = await lexopti.cases.create({\n\tclients: [{ id: \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\" }],\n\ttypes: [\"vente_immobiliere\"],\n\tlabel: \"Vente Durand, 12 rue des Lilas\",\n\tparties: [\n\t\t{\n\t\t\ttype: \"person\",\n\t\t\trole: \"acquereur\",\n\t\t\tperson: {\n\t\t\t\tfirst_name: \"Léa\",\n\t\t\t\tlast_name: \"Martin\",\n\t\t\t\tbirth_date: \"1988-04-12\",\n\t\t\t\tnationalities: [\"FR\"],\n\t\t\t},\n\t\t\texternal_ref: \"crm:contact:2001\",\n\t\t},\n\t],\n\texternal_ref: \"crm:deal:42\",\n});\nconsole.log(dossier.id, dossier.credits_charged, dossier.parties.length);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST \"https://app.lexopti.com/v1/cases\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n    \"clients\": [\n      {\n        \"id\": \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\"\n      }\n    ],\n    \"types\": [\n      \"vente_immobiliere\"\n    ],\n    \"label\": \"Vente Durand, 12 rue des Lilas\",\n    \"parties\": [\n      {\n        \"type\": \"person\",\n        \"role\": \"acquereur\",\n        \"person\": {\n          \"first_name\": \"Léa\",\n          \"last_name\": \"Martin\",\n          \"birth_date\": \"1988-04-12\",\n          \"nationalities\": [\n            \"FR\"\n          ]\n        },\n        \"external_ref\": \"crm:contact:2001\"\n      }\n    ],\n    \"external_ref\": \"crm:matter:42\"\n  }'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('POST', 'https://app.lexopti.com/v1/cases', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [\n        'clients' => [\n            [\n                'id' => '6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10',\n            ],\n        ],\n        'types' => [\n            'vente_immobiliere',\n        ],\n        'label' => 'Vente Durand, 12 rue des Lilas',\n        'parties' => [\n            [\n                'type' => 'person',\n                'role' => 'acquereur',\n                'person' => [\n                    'first_name' => 'Léa',\n                    'last_name' => 'Martin',\n                    'birth_date' => '1988-04-12',\n                    'nationalities' => [\n                        'FR',\n                    ],\n                ],\n                'external_ref' => 'crm:contact:2001',\n            ],\n        ],\n        'external_ref' => 'crm:matter:42',\n    ],\n]);"
          }
        ]
      }
    },
    "/cases/preview": {
      "post": {
        "operationId": "cases.preview",
        "summary": "Preview a case's cost",
        "description": "What creating this case would cost now, before anything exists, as LexOpti's « Nouveau dossier » screen prices it on its button: the same body as `POST /v1/cases`, checked as the creation checks it, nothing written. Show it to the member before creating. The creation checks the balance again: a balance spent meanwhile still refuses it.",
        "tags": [
          "Cases"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clients": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "description": "The client's LexOpti id."
                        },
                        "external_ref": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                          "description": "Or your application's reference of the client."
                        }
                      },
                      "description": "An existing client of the organization, by its id or by your reference (one of them): create a new one first with `POST /v1/clients`."
                    },
                    "description": "The case's clients, the main one first: existing clients of the organization."
                  },
                  "types": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 10,
                    "items": {
                      "type": "string",
                      "pattern": "^[a-z0-9_]{1,64}$"
                    },
                    "description": "The case's natures, among those the organization's profession offers (the portal lists them), or `custom` with `type_label`."
                  },
                  "type_label": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 160,
                    "pattern": "^[^\\u0000-\\u001F\\u007F-\\u009F]*$",
                    "description": "The free-form nature, with `custom` only."
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "pattern": "^[^\\u0000-\\u001F\\u007F-\\u009F]*$",
                    "description": "The case's title; by default its main client's name."
                  },
                  "parties": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "const": "person",
                              "description": "`person` or `company`: send the matching object, `person` or `company`."
                            },
                            "role": {
                              "enum": [
                                "demandeur",
                                "defendeur",
                                "appelant",
                                "intime",
                                "intervenant",
                                "partie_adverse",
                                "vendeur",
                                "acquereur",
                                "cedant",
                                "cessionnaire",
                                "contrepartie",
                                "bailleur",
                                "locataire",
                                "preteur",
                                "emprunteur",
                                "caution",
                                "tiers_payeur",
                                "donateur",
                                "donataire",
                                "heritier_legataire",
                                "mandant",
                                "mandataire",
                                "representant_legal",
                                "intermediaire",
                                "associe",
                                "constituant",
                                "fiduciaire",
                                "beneficiaire",
                                "tiers",
                                "autre"
                              ],
                              "type": "string",
                              "description": "The party's role in the case, a stable code in French (`vendeur`: seller, `acquereur`: buyer, `tiers_payeur`: third-party payer…). Each profession offers its own subset; a role it no longer offers still shows on an older party. New roles may be added: show an unknown one as `autre`."
                            },
                            "person": {
                              "type": "object",
                              "properties": {
                                "first_name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "First name(s), as on the identity document. Example: `Camille`."
                                },
                                "last_name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "Last name, as on the identity document. Example: `Durand`."
                                },
                                "usage_name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "The name the person uses when it differs from `last_name`, such as a married name (« nom d'usage »). Example: `Martin`."
                                },
                                "birth_date": {
                                  "type": "string",
                                  "format": "date",
                                  "description": "Date of birth, `YYYY-MM-DD`. Needed to launch a check (`incomplete_identity` otherwise). Example: `1980-02-01`."
                                },
                                "birth_city": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "City of birth. Example: `Lyon`."
                                },
                                "birth_country": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z]{2}$",
                                  "description": "Country of birth: ISO 3166-1 alpha-2 code (`FR`, not `France`), upper-cased by LexOpti. Example: `FR`."
                                },
                                "nationalities": {
                                  "type": "array",
                                  "maxItems": 10,
                                  "items": {
                                    "type": "string",
                                    "pattern": "^[A-Za-z]{2}$"
                                  },
                                  "description": "Nationalities: ISO 3166-1 alpha-2 codes (`FR`, not `France`), upper-cased by LexOpti, 10 at most. At least one is needed to launch a check (`incomplete_identity` otherwise): the check compares them with the nationalities on sanctions lists and of politically exposed persons (PEP). Example: `[\"FR\"]`."
                                }
                              },
                              "required": [
                                "first_name",
                                "last_name"
                              ],
                              "description": "The person's identity, with `type: person`."
                            },
                            "address": {
                              "type": "object",
                              "properties": {
                                "line": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "Number, street and any complement. Example: `12 rue de la Paix`."
                                },
                                "postal_code": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "Postal code. Example: `75002`."
                                },
                                "city": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "City. Example: `Paris`."
                                },
                                "country": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z]{2}$",
                                  "description": "Country: ISO 3166-1 alpha-2 code (`FR`, not `France`), upper-cased by LexOpti. Example: `FR`."
                                }
                              },
                              "description": "The postal address. Optional."
                            },
                            "external_ref": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                              "description": "Your reference of the person (a contact of your software who is not a client): a person it already names joins the case instead of a new one, else the new party is linked to it."
                            }
                          },
                          "required": [
                            "type",
                            "role",
                            "person"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "const": "company",
                              "description": "`person` or `company`: send the matching object, `person` or `company`."
                            },
                            "role": {
                              "enum": [
                                "demandeur",
                                "defendeur",
                                "appelant",
                                "intime",
                                "intervenant",
                                "partie_adverse",
                                "vendeur",
                                "acquereur",
                                "cedant",
                                "cessionnaire",
                                "contrepartie",
                                "bailleur",
                                "locataire",
                                "preteur",
                                "emprunteur",
                                "caution",
                                "tiers_payeur",
                                "donateur",
                                "donataire",
                                "heritier_legataire",
                                "mandant",
                                "mandataire",
                                "representant_legal",
                                "intermediaire",
                                "associe",
                                "constituant",
                                "fiduciaire",
                                "beneficiaire",
                                "tiers",
                                "autre"
                              ],
                              "type": "string",
                              "description": "The party's role in the case, a stable code in French (`vendeur`: seller, `acquereur`: buyer, `tiers_payeur`: third-party payer…). Each profession offers its own subset; a role it no longer offers still shows on an older party. New roles may be added: show an unknown one as `autre`."
                            },
                            "company": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "The company's registered name. Example: `Atelier Durand`."
                                },
                                "siren": {
                                  "type": "string",
                                  "pattern": "^\\d{9}$",
                                  "description": "SIREN: nine digits, without spaces. With `registration_country`, needed to launch a check on a French company. Example: `552100554`."
                                },
                                "siret": {
                                  "type": "string",
                                  "pattern": "^\\d{14}$",
                                  "description": "SIRET of one of its establishments: 14 digits, without spaces. Example: `55210055400013`."
                                },
                                "legal_form": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "Legal form, usually its abbreviation. Example: `SAS`."
                                },
                                "registration_country": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z]{2}$",
                                  "description": "Country of registration: ISO 3166-1 alpha-2 code (`FR`, not `France`), upper-cased by LexOpti. Example: `FR`."
                                },
                                "rcs": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "Trade and companies register (RCS) entry, as on the Kbis. Example: `Nice B 552 100 554`."
                                }
                              },
                              "required": [
                                "name"
                              ],
                              "description": "The company's identity, with `type: company`."
                            },
                            "address": {
                              "type": "object",
                              "properties": {
                                "line": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "Number, street and any complement. Example: `12 rue de la Paix`."
                                },
                                "postal_code": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "Postal code. Example: `75002`."
                                },
                                "city": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255,
                                  "description": "City. Example: `Paris`."
                                },
                                "country": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z]{2}$",
                                  "description": "Country: ISO 3166-1 alpha-2 code (`FR`, not `France`), upper-cased by LexOpti. Example: `FR`."
                                }
                              },
                              "description": "The postal address. Optional."
                            },
                            "external_ref": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                              "description": "Your reference of the company: a company it already names joins the case instead of a new one, else the new party is linked to it."
                            }
                          },
                          "required": [
                            "type",
                            "role",
                            "company"
                          ]
                        }
                      ],
                      "description": "A party of the case who is not one of its clients (the other side, a seller, a funder…), with its role among those the organization's profession offers (the portal lists them)."
                    },
                    "description": "The other parties, created with the case: each counts as one person or company in its price."
                  },
                  "external_ref": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                    "description": "Your reference for the new case (a matter, a mandate, an engagement…), linked with its creation: a reference already used answers 409 `external_ref_conflict` and creates nothing."
                  },
                  "launch_checks": {
                    "type": "boolean",
                    "description": "Launch the case's analyses once it is created, as LexOpti's « Lancer les analyses » does, when that costs nothing more than the creation; otherwise (an existing client edited since its last check counts once more) nothing is launched and `analyses_launched` is false. The identities to screen must then be complete (`incomplete_identity`, nothing created)."
                  }
                },
                "required": [
                  "clients",
                  "types"
                ]
              },
              "examples": {
                "a_transfer_of_shares_with_a_company_as_transferee": {
                  "summary": "A transfer of shares, with a company as transferee",
                  "value": {
                    "clients": [
                      {
                        "id": "6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10"
                      }
                    ],
                    "types": [
                      "cession_titres"
                    ],
                    "parties": [
                      {
                        "type": "company",
                        "role": "cessionnaire",
                        "company": {
                          "name": "Horizon Participations SAS",
                          "siren": "552100554",
                          "registration_country": "FR"
                        }
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "credits": {
                      "type": "object",
                      "properties": {
                        "needed": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991,
                          "description": "What creating the case spends: one credit per group of five people or companies, one at least."
                        },
                        "balance": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991,
                          "description": "What the organization can spend now."
                        }
                      },
                      "required": [
                        "needed",
                        "balance"
                      ],
                      "description": "One credit = one case of up to five people or companies, under vigilance for twelve months."
                    },
                    "sufficient_credits": {
                      "type": "boolean",
                      "description": "The balance pays the creation; false: it would be refused (`quota_exceeded`)."
                    },
                    "tranches": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "The groups of five people or companies the case's first year would pay for."
                    },
                    "entities": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "The people and companies those groups count: the clients with their beneficial owners (the people who own or control a company) and representatives, and the parties; one already counted by another running case of the organization is not counted again."
                    },
                    "livemode": {
                      "type": "boolean",
                      "description": "False in a sandbox: the credits are computed as for a real organization, never drawn."
                    }
                  },
                  "required": [
                    "credits",
                    "sufficient_credits",
                    "tranches",
                    "entities",
                    "livemode"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst preview = await lexopti.cases.preview({\n\tclients: [{ id: \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\" }],\n\ttypes: [\"vente_immobiliere\"],\n\tparties: [\n\t\t{\n\t\t\ttype: \"company\",\n\t\t\trole: \"vendeur\",\n\t\t\tcompany: { name: \"SCI Horizon\", siren: \"552100554\" },\n\t\t},\n\t],\n});\nconsole.log(\n\tpreview.credits.needed,\n\tpreview.credits.balance,\n\tpreview.sufficient_credits\n);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST \"https://app.lexopti.com/v1/cases/preview\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n    \"clients\": [\n      {\n        \"id\": \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\"\n      }\n    ],\n    \"types\": [\n      \"cession_titres\"\n    ],\n    \"parties\": [\n      {\n        \"type\": \"company\",\n        \"role\": \"cessionnaire\",\n        \"company\": {\n          \"name\": \"Horizon Participations SAS\",\n          \"siren\": \"552100554\",\n          \"registration_country\": \"FR\"\n        }\n      }\n    ]\n  }'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('POST', 'https://app.lexopti.com/v1/cases/preview', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [\n        'clients' => [\n            [\n                'id' => '6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10',\n            ],\n        ],\n        'types' => [\n            'cession_titres',\n        ],\n        'parties' => [\n            [\n                'type' => 'company',\n                'role' => 'cessionnaire',\n                'company' => [\n                    'name' => 'Horizon Participations SAS',\n                    'siren' => '552100554',\n                    'registration_country' => 'FR',\n                ],\n            ],\n        ],\n    ],\n]);"
          }
        ]
      }
    },
    "/cases/{id}": {
      "get": {
        "operationId": "cases.get",
        "summary": "Get a case",
        "description": "One case of the organization, with its clients, its parties and their roles, its levels, its classification's state and its pending alerts.",
        "tags": [
          "Cases"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Case"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst dossier = await lexopti.cases.get({\n\tid: \"0c9e6a1f-8b3d-4e27-a5f6-1d2c3b4a5e60\",\n});\nconsole.log(dossier.label, dossier.risk_level, dossier.classification_state);\nfor (const client of dossier.clients) {\n\tconsole.log(client.id, client.external_ref, client.main);\n}\nfor (const party of dossier.parties) {\n\tconsole.log(party.role, party.name);\n}"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/cases/:id\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/cases/:id', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/cases/{id}/checks": {
      "post": {
        "operationId": "cases.launchChecks",
        "summary": "Launch the case's analyses",
        "description": "Screens every client of the case with the people linked to it, and the case's own parties and subjects, as LexOpti's « Lancer les analyses » button does on the case page. No body. The identities to screen must be complete (`incomplete_identity`, nothing launched). The launch is charged to the case: free while the case's paid year and its groups of five people or companies cover it, one more credit per further group of five, a new year once the year has ended (`quota_exceeded` when the balance cannot pay it, `subscription_inactive` without an offer running; nothing is launched then). Each client's launch is a check of your application (`checks`); the parties' screenings belong to the case itself (its `status`). Asynchronous: follow the checks, or wait for `check.completed` / `check.failed`. A closed case answers 409 `case_closed`. Requires an `Idempotency-Key`; a retry with it answers the first launch.",
        "tags": [
          "Cases"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Unique key of this request (a UUID): a retry with the same key and body gets the first answer.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "responses": {
          "202": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The case's LexOpti id."
                    },
                    "external_ref": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                          "description": "Your own id for the record, e.g. `crm:contact:1042`: 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique per application, organization and kind (client or case). An opaque technical id, never personal data (no name, birth date, e-mail…). Visible to your application only."
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Your application's reference for the case, null when it has none. Another application's reference is never shown."
                    },
                    "label": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The case's title, as LexOpti shows it."
                    },
                    "type": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The kind of matter, as the profession's policy names it: the first of `types`."
                    },
                    "types": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Every nature of the case, the first being `type` (a case may have several, as LexOpti's screen picks them)."
                    },
                    "type_label": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Free-form nature, when `type` is `custom`."
                    },
                    "status": {
                      "enum": [
                        "pending",
                        "running",
                        "completed",
                        "failed"
                      ],
                      "type": "string",
                      "description": "Where the case's own launch stands (`launch_checks` at creation, `POST /v1/cases/{id}/checks`, or the « Lancer les analyses » button in LexOpti): `pending` (none launched yet), `running` (in progress), `completed` (every source answered) or `failed` (a source could not be screened). A check charged to the case by `POST /v1/checks` with `case_id` has its own status and does not change this one: read `pending_alert_count` and the checks for the clients' results."
                    },
                    "client_id": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The main client."
                    },
                    "client_ids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Every client of the case, the main one first."
                    },
                    "clients": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "The client's LexOpti id."
                          },
                          "external_ref": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                                "description": "Your own id for the record, e.g. `crm:contact:1042`: 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique per application, organization and kind (client or case). An opaque technical id, never personal data (no name, birth date, e-mail…). Visible to your application only."
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Your application's reference for the client, null when it has none."
                          },
                          "main": {
                            "type": "boolean",
                            "description": "The case's main client."
                          }
                        },
                        "required": [
                          "id",
                          "external_ref",
                          "main"
                        ]
                      },
                      "description": "Every client of the case, the main one first, with your references."
                    },
                    "parties": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "The party's id in this case (another case gives the same person or company another id; `entity_id` stays the same)."
                          },
                          "entity_id": {
                            "type": "string",
                            "description": "The person or company: the same in every case it is a party of."
                          },
                          "external_ref": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                                "description": "Your own id for the record, e.g. `crm:contact:1042`: 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique per application, organization and kind (client or case). An opaque technical id, never personal data (no name, birth date, e-mail…). Visible to your application only."
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Your application's reference of the person or company (a contact of your software who is not a client), the same in every case it is a party of; null when you set none."
                          },
                          "role": {
                            "enum": [
                              "demandeur",
                              "defendeur",
                              "appelant",
                              "intime",
                              "intervenant",
                              "partie_adverse",
                              "vendeur",
                              "acquereur",
                              "cedant",
                              "cessionnaire",
                              "contrepartie",
                              "bailleur",
                              "locataire",
                              "preteur",
                              "emprunteur",
                              "caution",
                              "tiers_payeur",
                              "donateur",
                              "donataire",
                              "heritier_legataire",
                              "mandant",
                              "mandataire",
                              "representant_legal",
                              "intermediaire",
                              "associe",
                              "constituant",
                              "fiduciaire",
                              "beneficiaire",
                              "tiers",
                              "autre"
                            ],
                            "type": "string",
                            "description": "The party's role in the case, a stable code in French (`vendeur`: seller, `acquereur`: buyer, `tiers_payeur`: third-party payer…). Each profession offers its own subset; a role it no longer offers still shows on an older party. New roles may be added: show an unknown one as `autre`."
                          },
                          "type": {
                            "enum": [
                              "person",
                              "company"
                            ],
                            "type": "string",
                            "description": "`person` or `company`."
                          },
                          "name": {
                            "type": "string",
                            "description": "Display name."
                          },
                          "monitoring_enabled": {
                            "type": "boolean",
                            "description": "Ongoing vigilance: the party is screened again as sources change."
                          }
                        },
                        "required": [
                          "id",
                          "entity_id",
                          "external_ref",
                          "role",
                          "type",
                          "name",
                          "monitoring_enabled"
                        ],
                        "description": "A party of the case that is not one of its clients (the other side, a funder…), with its role."
                      },
                      "description": "The other parties of the case, with their roles."
                    },
                    "transaction_amount": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The transaction's amount, as a member entered it in LexOpti: free text, without a fixed unit or format. Null when not given."
                    },
                    "monitoring_enabled": {
                      "type": "boolean",
                      "description": "Ongoing vigilance: the case is screened again as sources change."
                    },
                    "vigilance_level": {
                      "anyOf": [
                        {
                          "enum": [
                            "simplified",
                            "standard",
                            "enhanced"
                          ],
                          "type": "string",
                          "description": "Vigilance level LexOpti derives from the check results: `simplified` (lighter checks), `standard` or `enhanced` (closer checks). It is not the professional's decision, which is `risk_level`. [Glossary](https://developers.lexopti.com/glossary/)."
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Vigilance level LexOpti derives from the case's check results: `simplified` (lighter checks), `standard` or `enhanced` (closer checks). Null until the case's first check. It is not the professional's decision, which is `risk_level`."
                    },
                    "risk_level": {
                      "anyOf": [
                        {
                          "enum": [
                            "simplified",
                            "standard",
                            "enhanced"
                          ],
                          "type": "string",
                          "description": "Vigilance level LexOpti derives from the check results: `simplified` (lighter checks), `standard` or `enhanced` (closer checks). It is not the professional's decision, which is `risk_level`. [Glossary](https://developers.lexopti.com/glossary/)."
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Risk level of the case, validated by the professional in LexOpti and computed without the suspicion elements, which stay confidential. `null` until they set it. Read-only: the API cannot change it."
                    },
                    "classification_state": {
                      "enum": [
                        "to_complete",
                        "in_progress",
                        "validated",
                        "revalidate"
                      ],
                      "type": "string",
                      "description": "Where the case's classification stands; read it with `GET /v1/cases/{id}/classification`."
                    },
                    "has_pending_alert": {
                      "type": "boolean",
                      "description": "At least one alert awaits a member's review."
                    },
                    "pending_alert_count": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991,
                      "description": "Alerts awaiting a member's review, as the case page shows them: those of every client of the case and of its parties."
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When it was created (ISO 8601, UTC)."
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When it last changed (ISO 8601, UTC)."
                    },
                    "checks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "client_id": {
                            "type": "string",
                            "description": "The client this check screens."
                          },
                          "status": {
                            "enum": [
                              "running",
                              "completed",
                              "failed"
                            ],
                            "type": "string",
                            "description": "`running` until every source answered; `failed` when one of them could not be screened."
                          }
                        },
                        "required": [
                          "id",
                          "client_id",
                          "status"
                        ],
                        "description": "One client's check, launched by this call: read it with `GET /v1/checks/{id}` for the status of each source."
                      },
                      "description": "The checks this launch created, one per client of the case it screened (a client already analysed, with nothing new to screen, gets none). The parties' runs are the case's own: follow its `status`."
                    }
                  },
                  "required": [
                    "id",
                    "external_ref",
                    "label",
                    "type",
                    "types",
                    "type_label",
                    "status",
                    "client_id",
                    "client_ids",
                    "clients",
                    "parties",
                    "transaction_amount",
                    "monitoring_enabled",
                    "vigilance_level",
                    "risk_level",
                    "classification_state",
                    "has_pending_alert",
                    "pending_alert_count",
                    "created_at",
                    "updated_at",
                    "checks"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst launch = await lexopti.cases.launchChecks({\n\tid: \"0c9e6a1f-8b3d-4e27-a5f6-1d2c3b4a5e60\",\n});\nconsole.log(launch.status, launch.checks.length);\nfor (const check of launch.checks) {\n\tconsole.log(check.id, check.client_id, check.status);\n}"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST \"https://app.lexopti.com/v1/cases/:id/checks\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{}'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('POST', 'https://app.lexopti.com/v1/cases/:id/checks', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [],\n]);"
          }
        ]
      }
    },
    "/cases/{id}/classification": {
      "get": {
        "operationId": "cases.getClassification",
        "summary": "Get the case's classification",
        "description": "The case's risk assessment as saved: the questionnaire a member answers about the risk of the case, called « classification TRACFIN » in LexOpti. Its state, score and vigilance level, its last validation, its answers (every axis, its clients' `axe2` answers included) and the questions still unanswered. Read only: only a member answers and validates it, in LexOpti or its embedded screens. Reading changes nothing. A case never assessed answers `to_complete`, without answers. [Glossary](https://developers.lexopti.com/glossary/).",
        "tags": [
          "Cases"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Classification"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst classification = await lexopti.cases.getClassification({\n\tid: \"0c9e6a1f-8b3d-4e27-a5f6-1d2c3b4a5e60\",\n});\nif (classification.state === \"validated\") {\n\tconsole.log(classification.level, classification.validated_at);\n} else {\n\tconsole.log(classification.state, classification.missing_answers.count);\n}"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/cases/:id/classification\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/cases/:id/classification', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/cases/{id}/report": {
      "get": {
        "operationId": "cases.getReport",
        "summary": "Get the case's report",
        "description": "The case's report as a PDF, through a signed URL valid 5 minutes: LexOpti's own report, generated from the case's current state, in the version for partners, which never includes the suspicion axis (axis 5 and its fraud criteria) and computes its scores without it. Its `version` (also the `ETag` header) names its content: the same version is the same file. The first call for a new version renders it (a few seconds); later ones reuse it. Never archived as a version of the member's report. Language from `Accept-Language`.",
        "tags": [
          "Cases"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "case_id": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$",
                      "description": "Identifies what the report shows: the same version is the same content, in every language. It changes when the case's persons, analyses or classification change (the suspicion axis left out). Also the `ETag` header."
                    },
                    "sha256": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$",
                      "description": "SHA-256 of the PDF file, hexadecimal: check the file you downloaded against it."
                    },
                    "language": {
                      "enum": [
                        "fr",
                        "en"
                      ],
                      "type": "string",
                      "description": "The report's language, from `Accept-Language`."
                    },
                    "generated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When this file was produced; the same version is reused."
                    },
                    "excluded_axes": {
                      "type": "array",
                      "items": {
                        "const": "axe5"
                      },
                      "description": "Never in this report: the suspicion axis (`axe5`, its fraud criteria), which French law forbids disclosing (art. L. 561-18 of the Monetary and Financial Code). Its scores are computed without it."
                    },
                    "content_type": {
                      "const": "application/pdf"
                    },
                    "download_url": {
                      "type": "string",
                      "format": "uri",
                      "description": "A signed URL to download the file, valid 5 minutes (`expires_at`), without your access token. Do not store it: read the resource again for a new one."
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "case_id",
                    "version",
                    "sha256",
                    "language",
                    "generated_at",
                    "excluded_axes",
                    "content_type",
                    "download_url",
                    "expires_at"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst report = await lexopti.cases.getReport({\n\tid: \"0c9e6a1f-8b3d-4e27-a5f6-1d2c3b4a5e60\",\n});\n// The same version is the same file: download it only when it changed.\nconsole.log(report.version, report.sha256, report.excluded_axes);\n// Then fetch report.download_url (valid 5 minutes, no token needed) and\n// check its SHA-256 against report.sha256."
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/cases/:id/report\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/cases/:id/report', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/cases/{id}/documents": {
      "get": {
        "operationId": "cases.listDocuments",
        "summary": "List the case's documents",
        "description": "The documents of the case, newest first, each with a signed URL valid 5 minutes. The member's own report versions are not documents here: read the report with `GET /v1/cases/{id}/report`.",
        "tags": [
          "Cases"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "description": "Page size, 1 to 100."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Page size, 1 to 100."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "`next_cursor` of the previous page; omit for the first page."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "`next_cursor` of the previous page; omit for the first page."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "case_id": {
                            "type": "string"
                          },
                          "category": {
                            "enum": [
                              "imported",
                              "collected"
                            ],
                            "type": "string",
                            "description": "`imported`: added by a member; `collected`: gathered by LexOpti from a source (`collected_from`)."
                          },
                          "collected_from": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The source of a collected document, such as `bodacc` (the French official bulletin of company announcements)."
                          },
                          "file_name": {
                            "type": "string"
                          },
                          "content_type": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "size_bytes": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "entity_id": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The person or company the document concerns, if any."
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "download_url": {
                            "type": "string",
                            "format": "uri",
                            "description": "A signed URL to download the file, valid 5 minutes (`expires_at`), without your access token. Do not store it: read the resource again for a new one."
                          },
                          "expires_at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "id",
                          "case_id",
                          "category",
                          "collected_from",
                          "file_name",
                          "content_type",
                          "size_bytes",
                          "entity_id",
                          "created_at",
                          "download_url",
                          "expires_at"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Pass it as `cursor` to read the next page; null on the last one."
                    }
                  },
                  "required": [
                    "data",
                    "has_more",
                    "next_cursor"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst page = await lexopti.cases.listDocuments({\n\tid: \"0c9e6a1f-8b3d-4e27-a5f6-1d2c3b4a5e60\",\n});\nfor (const document of page.data) {\n\tconsole.log(document.file_name, document.category, document.expires_at);\n}"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/cases/:id/documents\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/cases/:id/documents', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/cases/{id}/external-ref": {
      "put": {
        "operationId": "cases.setExternalRef",
        "summary": "Set the case's reference",
        "description": "Links the case to your own id, replacing your previous one; the same reference again changes nothing. A reference already naming another case answers 409 `external_ref_conflict`. Visible to your application only.",
        "tags": [
          "Cases"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "external_ref": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                    "description": "Your own id for the record, e.g. `crm:contact:1042`: 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique per application, organization and kind (client or case). An opaque technical id, never personal data (no name, birth date, e-mail…). Visible to your application only."
                  }
                },
                "required": [
                  "external_ref"
                ]
              },
              "examples": {
                "your_matter_s_id": {
                  "summary": "Your matter's id",
                  "value": {
                    "external_ref": "crm:matter:42"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Case"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `external_ref` already names another case of your application (`external_ref_conflict`): find it with `GET /v1/cases?external_ref=`.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst dossier = await lexopti.cases.setExternalRef({\n\tid: \"0c9e6a1f-8b3d-4e27-a5f6-1d2c3b4a5e60\",\n\texternal_ref: \"crm:mandate:318\",\n});\nconst page = await lexopti.cases.list({ external_ref: \"crm:mandate:318\" });\nconsole.log(dossier.external_ref, page.data[0]?.id);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X PUT \"https://app.lexopti.com/v1/cases/:id/external-ref\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n    \"external_ref\": \"crm:matter:42\"\n  }'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('PUT', 'https://app.lexopti.com/v1/cases/:id/external-ref', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [\n        'external_ref' => 'crm:matter:42',\n    ],\n]);"
          }
        ]
      },
      "delete": {
        "operationId": "cases.deleteExternalRef",
        "summary": "Remove the case's reference",
        "description": "Unlinks the case from your reference, which may then name another case. Idempotent: a case without a reference answers the same. Other applications' references stay.",
        "tags": [
          "Cases"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Case"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst dossier = await lexopti.cases.deleteExternalRef({\n\tid: \"0c9e6a1f-8b3d-4e27-a5f6-1d2c3b4a5e60\",\n});\nconsole.log(dossier.external_ref);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X DELETE \"https://app.lexopti.com/v1/cases/:id/external-ref\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('DELETE', 'https://app.lexopti.com/v1/cases/:id/external-ref', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/cases/{id}/parties/{party_id}/external-ref": {
      "put": {
        "operationId": "cases.setPartyExternalRef",
        "summary": "Set a party's reference",
        "description": "Links a party of the case (the other side, a lender, a seller… who is not a client) to your own id of that person or company, replacing your previous one; the same reference again changes nothing. The reference names the person or company, so it follows it into every case it is a party of. A reference already naming another party answers 409 `external_ref_conflict`. Visible to your application only.",
        "tags": [
          "Cases"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          },
          {
            "name": "party_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The party's `id` in the case (`parties[].id`)."
            },
            "description": "The party's `id` in the case (`parties[].id`)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "external_ref": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                    "description": "Your own id for the record, e.g. `crm:contact:1042`: 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique per application, organization and kind (client or case). An opaque technical id, never personal data (no name, birth date, e-mail…). Visible to your application only."
                  }
                },
                "required": [
                  "external_ref"
                ]
              },
              "examples": {
                "your_contact_s_id": {
                  "summary": "Your contact's id",
                  "value": {
                    "external_ref": "crm:contact:2001"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Case"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst dossier = await lexopti.cases.setPartyExternalRef({\n\tid: \"0c9e6a1f-8b3d-4e27-a5f6-1d2c3b4a5e60\",\n\tparty_id: \"b7c1e2d3-4f5a-4b6c-8d7e-9f0a1b2c3d4e\",\n\texternal_ref: \"crm:contact:77\",\n});\n// Every case that contact is a party of.\nconst cases = await lexopti.cases.list({\n\tparty_external_ref: \"crm:contact:77\",\n});\nconsole.log(dossier.parties[0]?.external_ref, cases.data.length);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X PUT \"https://app.lexopti.com/v1/cases/:id/parties/:party_id/external-ref\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n    \"external_ref\": \"crm:contact:2001\"\n  }'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('PUT', 'https://app.lexopti.com/v1/cases/:id/parties/:party_id/external-ref', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [\n        'external_ref' => 'crm:contact:2001',\n    ],\n]);"
          }
        ]
      },
      "delete": {
        "operationId": "cases.deletePartyExternalRef",
        "summary": "Remove a party's reference",
        "description": "Unlinks the party's person or company from your reference, in every case it is a party of. Idempotent: a party without a reference answers the same.",
        "tags": [
          "Cases"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          },
          {
            "name": "party_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The party's `id` in the case (`parties[].id`)."
            },
            "description": "The party's `id` in the case (`parties[].id`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Case"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst dossier = await lexopti.cases.deletePartyExternalRef({\n\tid: \"0c9e6a1f-8b3d-4e27-a5f6-1d2c3b4a5e60\",\n\tparty_id: \"b7c1e2d3-4f5a-4b6c-8d7e-9f0a1b2c3d4e\",\n});\nconsole.log(dossier.parties[0]?.external_ref);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X DELETE \"https://app.lexopti.com/v1/cases/:id/parties/:party_id/external-ref\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('DELETE', 'https://app.lexopti.com/v1/cases/:id/parties/:party_id/external-ref', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/checks": {
      "get": {
        "operationId": "checks.list",
        "summary": "List checks",
        "description": "The organization's checks, newest first.",
        "tags": [
          "Checks"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "description": "Page size, 1 to 100."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Page size, 1 to 100."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "`next_cursor` of the previous page; omit for the first page."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "`next_cursor` of the previous page; omit for the first page."
          },
          {
            "name": "client_id",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "Only the checks of this client."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Only the checks of this client."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Check"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Pass it as `cursor` to read the next page; null on the last one."
                    }
                  },
                  "required": [
                    "data",
                    "has_more",
                    "next_cursor"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst page = await lexopti.checks.list({\n\tclient_id: \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\",\n});\nconsole.log(page.data.map((check) => check.status));"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/checks\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/checks', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      },
      "post": {
        "operationId": "checks.create",
        "summary": "Launch a check",
        "description": "Screens the client and its related parties across the sources, as the app's launch does: the identity must be complete, and the check is charged to the client's case (`case_id`, or its only open case) as the app charges it: free within the case's paid year and for the people already counted, one more credit per further five people or companies, a new year once it ended (`quota_exceeded` when the balance cannot pay it, `subscription_inactive` without an offer running). Asynchronous: follow the check, or wait for `check.completed` / `check.failed`. Requires an `Idempotency-Key`.",
        "tags": [
          "Checks"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The client to screen. Its identity must be complete enough: a person's birth date and nationality, a French company's SIREN and country (`incomplete_identity` otherwise)."
                  },
                  "case_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The client's open case the check is charged to. By default, the client's only open case. With none, LexOpti first opens a « Relation d'affaires » (business relationship) case for the client, as its client page does, and charges that one. With several, the check is refused (`dossier_required`, with the list of cases to choose from; LexOpti calls a case a « dossier »)."
                  }
                },
                "required": [
                  "client_id"
                ]
              },
              "examples": {
                "screen_a_client": {
                  "summary": "Screen a client",
                  "value": {
                    "client_id": "6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Check"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs (`idempotency_request_in_progress`), or the check's launch is still under way (`check_launch_in_progress`): retry later with the same key and body.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Unique key of this request (a UUID): a retry with the same key and body gets the first answer.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst check = await lexopti.checks.create({\n\tclient_id: \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\",\n});\nconsole.log(check.id, check.status);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST \"https://app.lexopti.com/v1/checks\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n    \"client_id\": \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\"\n  }'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('POST', 'https://app.lexopti.com/v1/checks', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [\n        'client_id' => '6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10',\n    ],\n]);"
          }
        ]
      }
    },
    "/checks/{id}": {
      "get": {
        "operationId": "checks.get",
        "summary": "Get a check",
        "description": "One check, with the status of each source. Read the client for the results once it settled.",
        "tags": [
          "Checks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Check"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst check = await lexopti.checks.get({\n\tid: \"chk_4b8e1f0a9c7d6e5b3a2f1e0d9c8b7a6f\",\n});\nfor (const source of check.sources) {\n\tconsole.log(source.source, source.status);\n}"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/checks/:id\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/checks/:id', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/clients": {
      "get": {
        "operationId": "clients.list",
        "summary": "List clients",
        "description": "The organization's clients, newest first. Filter a page of your records in one request (`external_ref` or `ids`, comma-separated) and add what your screens show with `expand[]`.",
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "description": "Page size, 1 to 100."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Page size, 1 to 100."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "`next_cursor` of the previous page; omit for the first page."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "`next_cursor` of the previous page; omit for the first page."
          },
          {
            "name": "external_ref",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9:._-]{1,255}(?:,[A-Za-z0-9:._-]{1,255}){0,99}$",
              "description": "Only the clients with these references of your application, comma-separated (at most 100): `crm:contact:1,crm:contact:2`. An unknown reference is left out; none known gives an empty page."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Only the clients with these references of your application, comma-separated (at most 100): `crm:contact:1,crm:contact:2`. An unknown reference is left out; none known gives an empty page."
          },
          {
            "name": "ids",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,64}(?:,[A-Za-z0-9_-]{1,64}){0,99}$",
              "description": "Only these clients, by their LexOpti id, comma-separated (at most 100). An id of another organization is left out, as an unknown one."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Only these clients, by their LexOpti id, comma-separated (at most 100). An id of another organization is left out, as an unknown one."
          },
          {
            "name": "expand",
            "in": "query",
            "schema": {
              "type": "array",
              "maxItems": 16,
              "items": {
                "enum": [
                  "last_check",
                  "open_alerts_count",
                  "classification_state",
                  "cases"
                ],
                "type": "string",
                "description": "`last_check`: the client's latest check; `open_alerts_count`: its alerts awaiting a member's review; `classification_state`: where its classification stands; `cases`: its latest cases, with their validated risk level."
              },
              "description": "Fields to add to each client, sent as `expand[]=last_check&expand[]=cases` (as Stripe's `expand[]`): a single `expand=cases` is refused, a repeated one counts once. `cases` and `classification_state` weigh in the rate limit with the page they expand. One request then reads a whole page of records: read it once, keep it, and follow the webhooks rather than reading again for every page shown."
            },
            "style": "deepObject",
            "explode": true,
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Fields to add to each client, sent as `expand[]=last_check&expand[]=cases` (as Stripe's `expand[]`): a single `expand=cases` is refused, a repeated one counts once. `cases` and `classification_state` weigh in the rate limit with the page they expand. One request then reads a whole page of records: read it once, keep it, and follow the webhooks rather than reading again for every page shown."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Client"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Pass it as `cursor` to read the next page; null on the last one."
                    }
                  },
                  "required": [
                    "data",
                    "has_more",
                    "next_cursor"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst page = await lexopti.clients.list({\n\texternal_ref: [\"crm:contact:1042\", \"crm:contact:1043\"].join(\",\"),\n\texpand: [\"last_check\", \"open_alerts_count\", \"classification_state\"],\n\tlimit: 100,\n});\nfor (const client of page.data) {\n\tconsole.log(client.external_ref, client.vigilance_level);\n\tconsole.log(client.last_check?.status, client.open_alerts_count);\n}"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/clients\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/clients', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      },
      "post": {
        "operationId": "clients.create",
        "summary": "Create a client",
        "description": "Records a client without launching a check. Requires an `Idempotency-Key`.",
        "tags": [
          "Clients"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "person",
                        "description": "`person` or `company`: send the matching object, `person` or `company`."
                      },
                      "person": {
                        "type": "object",
                        "properties": {
                          "first_name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255,
                            "description": "First name(s), as on the identity document. Example: `Camille`."
                          },
                          "last_name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255,
                            "description": "Last name, as on the identity document. Example: `Durand`."
                          },
                          "usage_name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255,
                            "description": "The name the person uses when it differs from `last_name`, such as a married name (« nom d'usage »). Example: `Martin`."
                          },
                          "birth_date": {
                            "type": "string",
                            "format": "date",
                            "description": "Date of birth, `YYYY-MM-DD`. Needed to launch a check (`incomplete_identity` otherwise). Example: `1980-02-01`."
                          },
                          "birth_city": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255,
                            "description": "City of birth. Example: `Lyon`."
                          },
                          "birth_country": {
                            "type": "string",
                            "pattern": "^[A-Za-z]{2}$",
                            "description": "Country of birth: ISO 3166-1 alpha-2 code (`FR`, not `France`), upper-cased by LexOpti. Example: `FR`."
                          },
                          "nationalities": {
                            "type": "array",
                            "maxItems": 10,
                            "items": {
                              "type": "string",
                              "pattern": "^[A-Za-z]{2}$"
                            },
                            "description": "Nationalities: ISO 3166-1 alpha-2 codes (`FR`, not `France`), upper-cased by LexOpti, 10 at most. At least one is needed to launch a check (`incomplete_identity` otherwise): the check compares them with the nationalities on sanctions lists and of politically exposed persons (PEP). Example: `[\"FR\"]`."
                          }
                        },
                        "required": [
                          "first_name",
                          "last_name"
                        ],
                        "description": "The person's identity, with `type: person`."
                      },
                      "address": {
                        "type": "object",
                        "properties": {
                          "line": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255,
                            "description": "Number, street and any complement. Example: `12 rue de la Paix`."
                          },
                          "postal_code": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255,
                            "description": "Postal code. Example: `75002`."
                          },
                          "city": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255,
                            "description": "City. Example: `Paris`."
                          },
                          "country": {
                            "type": "string",
                            "pattern": "^[A-Za-z]{2}$",
                            "description": "Country: ISO 3166-1 alpha-2 code (`FR`, not `France`), upper-cased by LexOpti. Example: `FR`."
                          }
                        },
                        "description": "The postal address. Optional."
                      },
                      "external_ref": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                        "description": "Your reference for the new client, linked with its creation: a reference already used answers 409 `external_ref_conflict` and creates nothing."
                      }
                    },
                    "required": [
                      "type",
                      "person"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "const": "company",
                        "description": "`person` or `company`: send the matching object, `person` or `company`."
                      },
                      "company": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255,
                            "description": "The company's registered name. Example: `Atelier Durand`."
                          },
                          "siren": {
                            "type": "string",
                            "pattern": "^\\d{9}$",
                            "description": "SIREN: nine digits, without spaces. With `registration_country`, needed to launch a check on a French company. Example: `552100554`."
                          },
                          "siret": {
                            "type": "string",
                            "pattern": "^\\d{14}$",
                            "description": "SIRET of one of its establishments: 14 digits, without spaces. Example: `55210055400013`."
                          },
                          "legal_form": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255,
                            "description": "Legal form, usually its abbreviation. Example: `SAS`."
                          },
                          "registration_country": {
                            "type": "string",
                            "pattern": "^[A-Za-z]{2}$",
                            "description": "Country of registration: ISO 3166-1 alpha-2 code (`FR`, not `France`), upper-cased by LexOpti. Example: `FR`."
                          },
                          "rcs": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255,
                            "description": "Trade and companies register (RCS) entry, as on the Kbis. Example: `Nice B 552 100 554`."
                          }
                        },
                        "required": [
                          "name"
                        ],
                        "description": "The company's identity, with `type: company`."
                      },
                      "address": {
                        "type": "object",
                        "properties": {
                          "line": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255,
                            "description": "Number, street and any complement. Example: `12 rue de la Paix`."
                          },
                          "postal_code": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255,
                            "description": "Postal code. Example: `75002`."
                          },
                          "city": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255,
                            "description": "City. Example: `Paris`."
                          },
                          "country": {
                            "type": "string",
                            "pattern": "^[A-Za-z]{2}$",
                            "description": "Country: ISO 3166-1 alpha-2 code (`FR`, not `France`), upper-cased by LexOpti. Example: `FR`."
                          }
                        },
                        "description": "The postal address. Optional."
                      },
                      "external_ref": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                        "description": "Your reference for the new client, linked with its creation: a reference already used answers 409 `external_ref_conflict` and creates nothing."
                      }
                    },
                    "required": [
                      "type",
                      "company"
                    ]
                  }
                ],
                "description": "The client's identity. Creating a client launches no check and costs no credit: launch a check in one of its cases. When the organization's integration offer includes it, a free preliminary screening against the official freeze and sanctions lists follows (`preliminary_screening`)."
              },
              "examples": {
                "a_person": {
                  "summary": "A person",
                  "value": {
                    "type": "person",
                    "person": {
                      "first_name": "Camille",
                      "last_name": "Durand",
                      "birth_date": "1980-02-01",
                      "birth_city": "Lyon",
                      "birth_country": "FR",
                      "nationalities": [
                        "FR"
                      ]
                    },
                    "address": {
                      "line": "12 rue de la Paix",
                      "postal_code": "75002",
                      "city": "Paris",
                      "country": "FR"
                    },
                    "external_ref": "crm:contact:1042"
                  }
                },
                "a_company": {
                  "summary": "A company",
                  "value": {
                    "type": "company",
                    "company": {
                      "name": "Atelier Durand",
                      "siren": "552100554",
                      "legal_form": "SAS",
                      "registration_country": "FR",
                      "rcs": "Paris B 552 100 554"
                    },
                    "address": {
                      "line": "12 rue de la Paix",
                      "postal_code": "75002",
                      "city": "Paris",
                      "country": "FR"
                    },
                    "external_ref": "crm:account:77"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Client"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs (`idempotency_request_in_progress`), or the `external_ref` already names another client of your application (`external_ref_conflict`), in which case nothing is created: find that client with `GET /v1/clients?external_ref=`.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Unique key of this request (a UUID): a retry with the same key and body gets the first answer.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst client = await lexopti.clients.create({\n\ttype: \"company\",\n\tcompany: {\n\t\tname: \"Durand SAS\",\n\t\tsiren: \"552100554\",\n\t\tregistration_country: \"FR\",\n\t},\n\taddress: { city: \"Nice\", country: \"FR\" },\n\t// Your own id for the client, to find it again without storing ours.\n\texternal_ref: \"crm:company:2201\",\n});\nconsole.log(client.id, client.external_ref, client.monitoring_enabled);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST \"https://app.lexopti.com/v1/clients\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n    \"type\": \"person\",\n    \"person\": {\n      \"first_name\": \"Camille\",\n      \"last_name\": \"Durand\",\n      \"birth_date\": \"1980-02-01\",\n      \"birth_city\": \"Lyon\",\n      \"birth_country\": \"FR\",\n      \"nationalities\": [\n        \"FR\"\n      ]\n    },\n    \"address\": {\n      \"line\": \"12 rue de la Paix\",\n      \"postal_code\": \"75002\",\n      \"city\": \"Paris\",\n      \"country\": \"FR\"\n    },\n    \"external_ref\": \"crm:contact:1042\"\n  }'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('POST', 'https://app.lexopti.com/v1/clients', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [\n        'type' => 'person',\n        'person' => [\n            'first_name' => 'Camille',\n            'last_name' => 'Durand',\n            'birth_date' => '1980-02-01',\n            'birth_city' => 'Lyon',\n            'birth_country' => 'FR',\n            'nationalities' => [\n                'FR',\n            ],\n        ],\n        'address' => [\n            'line' => '12 rue de la Paix',\n            'postal_code' => '75002',\n            'city' => 'Paris',\n            'country' => 'FR',\n        ],\n        'external_ref' => 'crm:contact:1042',\n    ],\n]);"
          }
        ]
      }
    },
    "/clients/{id}": {
      "get": {
        "operationId": "clients.get",
        "summary": "Get a client",
        "description": "One client of the organization, with its identity and its levels.",
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          },
          {
            "name": "expand",
            "in": "query",
            "schema": {
              "type": "array",
              "maxItems": 16,
              "items": {
                "enum": [
                  "last_check",
                  "open_alerts_count",
                  "classification_state",
                  "cases"
                ],
                "type": "string",
                "description": "`last_check`: the client's latest check; `open_alerts_count`: its alerts awaiting a member's review; `classification_state`: where its classification stands; `cases`: its latest cases, with their validated risk level."
              },
              "description": "Fields to add to each client, sent as `expand[]=last_check&expand[]=cases` (as Stripe's `expand[]`): a single `expand=cases` is refused, a repeated one counts once. `cases` and `classification_state` weigh in the rate limit with the page they expand. One request then reads a whole page of records: read it once, keep it, and follow the webhooks rather than reading again for every page shown."
            },
            "style": "deepObject",
            "explode": true,
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Fields to add to each client, sent as `expand[]=last_check&expand[]=cases` (as Stripe's `expand[]`): a single `expand=cases` is refused, a repeated one counts once. `cases` and `classification_state` weigh in the rate limit with the page they expand. One request then reads a whole page of records: read it once, keep it, and follow the webhooks rather than reading again for every page shown."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Client"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst client = await lexopti.clients.get({\n\tid: \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\",\n});\nconsole.log(client.name, client.vigilance_level, client.risk_level);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/clients/:id\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/clients/:id', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      },
      "patch": {
        "operationId": "clients.update",
        "summary": "Update a client",
        "description": "Changes the client's identity with the app's own rules: an analysed client keeps its required identity fields (`incomplete_identity`), and a change of a screened field of a client under ongoing vigilance launches its re-analysis at once, as in the app, charged to the cases it was screened in: it counts once more in each, free while their paid places cover it (`quota_exceeded` when the credits cannot pay it, nothing changed). Completes an identity that a check refused (`incomplete_identity`). Idempotent: the same body again changes, launches and bills nothing. Sends `client.updated` with the fields that changed.",
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "person": {
                    "type": "object",
                    "properties": {
                      "first_name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255,
                        "description": "First name(s), as on the identity document. Example: `Camille`."
                      },
                      "last_name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255,
                        "description": "Last name, as on the identity document. Example: `Durand`."
                      },
                      "usage_name": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "The name the person uses when it differs from `last_name`, such as a married name (« nom d'usage »). Example: `Martin`."
                      },
                      "birth_date": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Date of birth, `YYYY-MM-DD`. Needed to launch a check (`incomplete_identity` otherwise). Example: `1980-02-01`."
                      },
                      "birth_city": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "City of birth. Example: `Lyon`."
                      },
                      "birth_country": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^[A-Za-z]{2}$"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Country of birth: ISO 3166-1 alpha-2 code (`FR`, not `France`), upper-cased by LexOpti. Example: `FR`."
                      },
                      "nationalities": {
                        "anyOf": [
                          {
                            "type": "array",
                            "maxItems": 10,
                            "items": {
                              "type": "string",
                              "pattern": "^[A-Za-z]{2}$"
                            }
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Nationalities: ISO 3166-1 alpha-2 codes (`FR`, not `France`), upper-cased by LexOpti, 10 at most. At least one is needed to launch a check (`incomplete_identity` otherwise): the check compares them with the nationalities on sanctions lists and of politically exposed persons (PEP). Example: `[\"FR\"]`. Replaces the whole list; `null` or `[]` clears it."
                      }
                    },
                    "additionalProperties": false,
                    "description": "For a person only."
                  },
                  "company": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255,
                        "description": "The company's registered name. Example: `Atelier Durand`."
                      },
                      "siren": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^\\d{9}$"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "SIREN: nine digits, without spaces. With `registration_country`, needed to launch a check on a French company. Example: `552100554`."
                      },
                      "siret": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^\\d{14}$"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "SIRET of one of its establishments: 14 digits, without spaces. Example: `55210055400013`."
                      },
                      "legal_form": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Legal form, usually its abbreviation. Example: `SAS`."
                      },
                      "registration_country": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^[A-Za-z]{2}$"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Country of registration: ISO 3166-1 alpha-2 code (`FR`, not `France`), upper-cased by LexOpti. Example: `FR`."
                      },
                      "rcs": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Trade and companies register (RCS) entry, as on the Kbis. Example: `Nice B 552 100 554`."
                      }
                    },
                    "additionalProperties": false,
                    "description": "For a company only."
                  },
                  "address": {
                    "type": "object",
                    "properties": {
                      "line": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Number, street and any complement. Example: `12 rue de la Paix`."
                      },
                      "postal_code": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Postal code. Example: `75002`."
                      },
                      "city": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "City. Example: `Paris`."
                      },
                      "country": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^[A-Za-z]{2}$"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "ISO 3166-1 alpha-2 code (`FR`, not `France`); a person's only (a company's country is `company.registration_country`)."
                      }
                    },
                    "additionalProperties": false,
                    "description": "For a person or a company."
                  }
                },
                "additionalProperties": false
              },
              "examples": {
                "complete_an_identity": {
                  "summary": "Complete an identity",
                  "value": {
                    "person": {
                      "birth_date": "1980-02-01",
                      "nationalities": [
                        "FR"
                      ]
                    },
                    "address": {
                      "line": "12 rue de la Paix",
                      "postal_code": "75002"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Client"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst client = await lexopti.clients.update({\n\tid: \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\",\n\tcompany: { legal_form: \"SAS\", rcs: \"Nice B 552 100 554\" },\n\t// null clears an optional field.\n\taddress: { line: \"12 avenue Jean Médecin\", postal_code: \"06000\" },\n});\nconsole.log(client.company?.legal_form, client.address.postal_code);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X PATCH \"https://app.lexopti.com/v1/clients/:id\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n    \"person\": {\n      \"birth_date\": \"1980-02-01\",\n      \"nationalities\": [\n        \"FR\"\n      ]\n    },\n    \"address\": {\n      \"line\": \"12 rue de la Paix\",\n      \"postal_code\": \"75002\"\n    }\n  }'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('PATCH', 'https://app.lexopti.com/v1/clients/:id', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [\n        'person' => [\n            'birth_date' => '1980-02-01',\n            'nationalities' => [\n                'FR',\n            ],\n        ],\n        'address' => [\n            'line' => '12 rue de la Paix',\n            'postal_code' => '75002',\n        ],\n    ],\n]);"
          }
        ]
      }
    },
    "/clients/{id}/classification": {
      "get": {
        "operationId": "clients.getClassification",
        "summary": "Get the client's classification",
        "description": "The client's own risk assessment as saved: the questions about the client and the people linked to it (`axe2` of the questionnaire called « classification TRACFIN » in LexOpti). Its state, score and vigilance level, its last validation, its answers and the questions still unanswered. Read only: only a member answers and validates it, in LexOpti or its embedded screens. Reading changes nothing. A client never assessed answers `to_complete`, without answers. [Glossary](https://developers.lexopti.com/glossary/).",
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Classification"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst classification = await lexopti.clients.getClassification({\n\tid: \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\",\n});\nconsole.log(classification.state, classification.level);\nconsole.log(\n\t`${classification.missing_answers.count} question(s) to answer in LexOpti`\n);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/clients/:id/classification\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/clients/:id/classification', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/clients/{id}/preliminary-screening": {
      "get": {
        "operationId": "clients.getPreliminaryScreening",
        "summary": "Get the client's preliminary screening",
        "description": "The free preliminary screening of a client your application created through the API or asked for: its current result (the latest completed search) and its latest request, which may still be pending. A result states the official freeze and sanctions lists searched with the publication, publisher and reuse terms of each, the matches with their official references and links, and when it was last confirmed. LexOpti screens such a client again, for free, at each new publication of the lists while the organization has an offer and the client is not under ongoing vigilance (`client.preliminary_screening_completed` tells a changed result). Freezes and sanctions only: a possible match on a binding list is to verify, and if confirmed the assets are frozen and reported to the DG Trésor without delay; an OFAC match is a US sanctions risk to assess. 404 when the client has none.",
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "client_id": {
                      "type": "string",
                      "description": "The client screened."
                    },
                    "current": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "description": "The id of this request."
                            },
                            "status": {
                              "enum": [
                                "pending",
                                "completed",
                                "failed",
                                "unavailable"
                              ],
                              "type": "string",
                              "description": "`pending`: queued; `completed`: the lists were searched (`outcome`); `failed`: the identity could not be searched (`error_code`); `unavailable`: the lists could not be searched for now, retried later by LexOpti."
                            },
                            "outcome": {
                              "anyOf": [
                                {
                                  "enum": [
                                    "no_match",
                                    "possible_match"
                                  ],
                                  "type": "string",
                                  "description": "`no_match`: no match in the lists searched, at the versions stated (never a statement that the client is compliant or not frozen); `possible_match`: at least one listed person or entity may be the client, to verify."
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Set when `status` is `completed`, null otherwise."
                            },
                            "trigger": {
                              "enum": [
                                "initial",
                                "identity_change",
                                "requested",
                                "list_update"
                              ],
                              "type": "string",
                              "description": "`initial`: your application created the client through the API; `identity_change`: your application changed a screened identity field of such a client; `requested`: your application asked for the screening (`POST /v1/clients/{id}/preliminary-screening`); `list_update`: a new publication of the lists changed the result."
                            },
                            "requested_at": {
                              "type": "string",
                              "format": "date-time",
                              "description": "When the screening was asked for."
                            },
                            "screened_at": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "When the search ran; null when none ran (`pending`, `unavailable`, or an identity that could not be searched)."
                            },
                            "checked_at": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Last time this result was confirmed against a publication of the lists; null unless `completed`."
                            },
                            "error_code": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Why it is `failed` or `unavailable`: `unscreenable_subject` (no name or identifier to search), `saturated` (too many candidates to declare the client clear), `lists_not_indexed` (the lists are not searchable yet), `yente_unavailable` (the search service did not answer), `screening_timeout` (the search could not run in time), `sandbox_error` (the sandbox's `ERREUR`). New codes may be added."
                            },
                            "lists": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "source": {
                                    "enum": [
                                      "fr_tresor_gels",
                                      "eu_fsf",
                                      "us_ofac_sdn"
                                    ],
                                    "type": "string",
                                    "description": "`fr_tresor_gels`: the French national asset-freeze register (kept by the DG Trésor, the French Treasury), binding; `eu_fsf`: the EU consolidated financial sanctions list, binding; `us_ofac_sdn`: the US OFAC SDN list, information on a US sanctions risk only, with no legal effect in France."
                                  },
                                  "binding": {
                                    "type": "boolean",
                                    "description": "A freeze list that binds in France (`fr_tresor_gels`, `eu_fsf`); false for OFAC."
                                  },
                                  "published_at": {
                                    "type": "string",
                                    "format": "date-time",
                                    "description": "The publication date the list itself states."
                                  },
                                  "publisher": {
                                    "type": "string",
                                    "description": "Who publishes the list: the DG Trésor, the European Commission, the US Treasury's OFAC."
                                  },
                                  "licence": {
                                    "type": "string",
                                    "description": "The reuse terms of the list: Licence Ouverte / Open Licence 2.0 (Etalab) for the French register, Commission Decision 2011/833/EU for the EU list, public domain (US government work) for OFAC."
                                  },
                                  "licence_url": {
                                    "type": "string",
                                    "description": "The text of those reuse terms."
                                  },
                                  "attribution": {
                                    "type": "string",
                                    "description": "The source statement to show beside a result built on the list (its publisher, licence and publication date), in the language of the request: the reuse terms of the French register and of the EU list require it."
                                  }
                                },
                                "required": [
                                  "source",
                                  "binding",
                                  "published_at",
                                  "publisher",
                                  "licence",
                                  "licence_url",
                                  "attribution"
                                ]
                              },
                              "description": "The lists searched and the publication of each, empty when no search ran: a result is only valid for these versions."
                            },
                            "matches": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "source": {
                                    "enum": [
                                      "fr_tresor_gels",
                                      "eu_fsf",
                                      "us_ofac_sdn"
                                    ],
                                    "type": "string",
                                    "description": "`fr_tresor_gels`: the French national asset-freeze register (kept by the DG Trésor, the French Treasury), binding; `eu_fsf`: the EU consolidated financial sanctions list, binding; `us_ofac_sdn`: the US OFAC SDN list, information on a US sanctions risk only, with no legal effect in France."
                                  },
                                  "binding": {
                                    "type": "boolean",
                                    "description": "A match on a binding freeze list: verify the identity and, if it is the designated person, freeze and report to the DG Trésor without delay. False for OFAC: a US sanctions risk to assess."
                                  },
                                  "listed_name": {
                                    "type": "string",
                                    "description": "The name as the list writes it."
                                  },
                                  "matched_name": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "The listed name or alias the client's identity matched."
                                  },
                                  "score": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1,
                                    "description": "How close the listed name is to the client's, from 0 to 1 (1: the same name). Names are compared loosely, to catch spelling variants."
                                  },
                                  "birth_dates": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    },
                                    "description": "`YYYY`, `YYYY-MM` or `YYYY-MM-DD`. An approximate date of the list (circa, a range of years) is spread over every year it may stand for."
                                  },
                                  "birth_dates_approximate": {
                                    "type": "boolean",
                                    "description": "The list states an approximate birth date (circa, a range of years, another calendar): the client's birth date never makes such a match a namesake."
                                  },
                                  "nationalities": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    },
                                    "description": "ISO 3166-1 alpha-2 codes."
                                  },
                                  "regime": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Sanctions regime or program."
                                  },
                                  "legal_basis": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "The act the listing rests on."
                                  },
                                  "official_reference": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "The entry's reference in its list."
                                  },
                                  "listed_at": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "First listing date (`YYYY-MM-DD`) when the list states it."
                                  },
                                  "source_url": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "The official page of the entry or of its legal act."
                                  },
                                  "homonym": {
                                    "type": "boolean",
                                    "description": "A probable namesake: the client's birth date contradicts every exact birth date of the listing. Shown, never counted in `outcome`."
                                  }
                                },
                                "required": [
                                  "source",
                                  "binding",
                                  "listed_name",
                                  "matched_name",
                                  "score",
                                  "birth_dates",
                                  "birth_dates_approximate",
                                  "nationalities",
                                  "regime",
                                  "legal_basis",
                                  "official_reference",
                                  "listed_at",
                                  "source_url",
                                  "homonym"
                                ]
                              },
                              "description": "Binding lists first, then by score."
                            }
                          },
                          "required": [
                            "id",
                            "status",
                            "outcome",
                            "trigger",
                            "requested_at",
                            "screened_at",
                            "checked_at",
                            "error_code",
                            "lists",
                            "matches"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The current result: the latest completed search, which a newer pending or unanswered request never hides. Null while the client has none."
                    },
                    "latest": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "The id of this request."
                        },
                        "status": {
                          "enum": [
                            "pending",
                            "completed",
                            "failed",
                            "unavailable"
                          ],
                          "type": "string",
                          "description": "`pending`: queued; `completed`: the lists were searched (`outcome`); `failed`: the identity could not be searched (`error_code`); `unavailable`: the lists could not be searched for now, retried later by LexOpti."
                        },
                        "outcome": {
                          "anyOf": [
                            {
                              "enum": [
                                "no_match",
                                "possible_match"
                              ],
                              "type": "string",
                              "description": "`no_match`: no match in the lists searched, at the versions stated (never a statement that the client is compliant or not frozen); `possible_match`: at least one listed person or entity may be the client, to verify."
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Set when `status` is `completed`, null otherwise."
                        },
                        "trigger": {
                          "enum": [
                            "initial",
                            "identity_change",
                            "requested",
                            "list_update"
                          ],
                          "type": "string",
                          "description": "`initial`: your application created the client through the API; `identity_change`: your application changed a screened identity field of such a client; `requested`: your application asked for the screening (`POST /v1/clients/{id}/preliminary-screening`); `list_update`: a new publication of the lists changed the result."
                        },
                        "requested_at": {
                          "type": "string",
                          "format": "date-time",
                          "description": "When the screening was asked for."
                        },
                        "screened_at": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "When the search ran; null when none ran (`pending`, `unavailable`, or an identity that could not be searched)."
                        },
                        "checked_at": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Last time this result was confirmed against a publication of the lists; null unless `completed`."
                        },
                        "error_code": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Why it is `failed` or `unavailable`: `unscreenable_subject` (no name or identifier to search), `saturated` (too many candidates to declare the client clear), `lists_not_indexed` (the lists are not searchable yet), `yente_unavailable` (the search service did not answer), `screening_timeout` (the search could not run in time), `sandbox_error` (the sandbox's `ERREUR`). New codes may be added."
                        },
                        "lists": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "enum": [
                                  "fr_tresor_gels",
                                  "eu_fsf",
                                  "us_ofac_sdn"
                                ],
                                "type": "string",
                                "description": "`fr_tresor_gels`: the French national asset-freeze register (kept by the DG Trésor, the French Treasury), binding; `eu_fsf`: the EU consolidated financial sanctions list, binding; `us_ofac_sdn`: the US OFAC SDN list, information on a US sanctions risk only, with no legal effect in France."
                              },
                              "binding": {
                                "type": "boolean",
                                "description": "A freeze list that binds in France (`fr_tresor_gels`, `eu_fsf`); false for OFAC."
                              },
                              "published_at": {
                                "type": "string",
                                "format": "date-time",
                                "description": "The publication date the list itself states."
                              },
                              "publisher": {
                                "type": "string",
                                "description": "Who publishes the list: the DG Trésor, the European Commission, the US Treasury's OFAC."
                              },
                              "licence": {
                                "type": "string",
                                "description": "The reuse terms of the list: Licence Ouverte / Open Licence 2.0 (Etalab) for the French register, Commission Decision 2011/833/EU for the EU list, public domain (US government work) for OFAC."
                              },
                              "licence_url": {
                                "type": "string",
                                "description": "The text of those reuse terms."
                              },
                              "attribution": {
                                "type": "string",
                                "description": "The source statement to show beside a result built on the list (its publisher, licence and publication date), in the language of the request: the reuse terms of the French register and of the EU list require it."
                              }
                            },
                            "required": [
                              "source",
                              "binding",
                              "published_at",
                              "publisher",
                              "licence",
                              "licence_url",
                              "attribution"
                            ]
                          },
                          "description": "The lists searched and the publication of each, empty when no search ran: a result is only valid for these versions."
                        },
                        "matches": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "enum": [
                                  "fr_tresor_gels",
                                  "eu_fsf",
                                  "us_ofac_sdn"
                                ],
                                "type": "string",
                                "description": "`fr_tresor_gels`: the French national asset-freeze register (kept by the DG Trésor, the French Treasury), binding; `eu_fsf`: the EU consolidated financial sanctions list, binding; `us_ofac_sdn`: the US OFAC SDN list, information on a US sanctions risk only, with no legal effect in France."
                              },
                              "binding": {
                                "type": "boolean",
                                "description": "A match on a binding freeze list: verify the identity and, if it is the designated person, freeze and report to the DG Trésor without delay. False for OFAC: a US sanctions risk to assess."
                              },
                              "listed_name": {
                                "type": "string",
                                "description": "The name as the list writes it."
                              },
                              "matched_name": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The listed name or alias the client's identity matched."
                              },
                              "score": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1,
                                "description": "How close the listed name is to the client's, from 0 to 1 (1: the same name). Names are compared loosely, to catch spelling variants."
                              },
                              "birth_dates": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "`YYYY`, `YYYY-MM` or `YYYY-MM-DD`. An approximate date of the list (circa, a range of years) is spread over every year it may stand for."
                              },
                              "birth_dates_approximate": {
                                "type": "boolean",
                                "description": "The list states an approximate birth date (circa, a range of years, another calendar): the client's birth date never makes such a match a namesake."
                              },
                              "nationalities": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "ISO 3166-1 alpha-2 codes."
                              },
                              "regime": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Sanctions regime or program."
                              },
                              "legal_basis": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The act the listing rests on."
                              },
                              "official_reference": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The entry's reference in its list."
                              },
                              "listed_at": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "First listing date (`YYYY-MM-DD`) when the list states it."
                              },
                              "source_url": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The official page of the entry or of its legal act."
                              },
                              "homonym": {
                                "type": "boolean",
                                "description": "A probable namesake: the client's birth date contradicts every exact birth date of the listing. Shown, never counted in `outcome`."
                              }
                            },
                            "required": [
                              "source",
                              "binding",
                              "listed_name",
                              "matched_name",
                              "score",
                              "birth_dates",
                              "birth_dates_approximate",
                              "nationalities",
                              "regime",
                              "legal_basis",
                              "official_reference",
                              "listed_at",
                              "source_url",
                              "homonym"
                            ]
                          },
                          "description": "Binding lists first, then by score."
                        }
                      },
                      "required": [
                        "id",
                        "status",
                        "outcome",
                        "trigger",
                        "requested_at",
                        "screened_at",
                        "checked_at",
                        "error_code",
                        "lists",
                        "matches"
                      ],
                      "description": "The latest request, whatever its status; the same as `current` once it completed."
                    }
                  },
                  "required": [
                    "client_id",
                    "current",
                    "latest"
                  ],
                  "description": "The client's free preliminary screening against the official freeze and sanctions lists. It covers freezes and sanctions only, with fuzzy matching, never the whole due diligence: open a case and launch a check for the complete analysis."
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst screening = await lexopti.clients.getPreliminaryScreening({\n\tid: \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\",\n});\n// A newer request may still be running: the current result stays shown.\nconsole.log(screening.latest.status);\nconst result = screening.current;\nif (result) {\n\tfor (const list of result.lists) {\n\t\t// The source statement the lists' reuse terms ask you to show.\n\t\tconsole.log(list.attribution);\n\t}\n\tif (result.outcome === \"possible_match\") {\n\t\tfor (const match of result.matches.filter((m) => !m.homonym)) {\n\t\t\tconsole.log(match.source, match.listed_name, match.source_url);\n\t\t}\n\t}\n}"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/clients/:id/preliminary-screening\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/clients/:id/preliminary-screening', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      },
      "post": {
        "operationId": "clients.requestPreliminaryScreening",
        "summary": "Request the client's preliminary screening",
        "description": "Asks for the free preliminary screening of any client your token reaches, whoever created it (a client created in LexOpti and linked to your reference included): a search of the official freeze and sanctions lists, free, never a check. No body. LexOpti screens a client your application creates through the API by itself; this operation is for the others, and for a client whose identity changed outside your application. Asynchronous: the answer is the client's screening with its new `pending` request (`trigger: requested`) and its current result, kept until the new one settles; follow `client.preliminary_screening_completed` or read `GET /v1/clients/{id}/preliminary-screening`. A sandbox answers at once. A request still running answers 409 `preliminary_screening_pending`; a deployment without the feature or its lists, 503 `preliminary_screening_unavailable`. Requires an `Idempotency-Key`; a retry with it answers the first request.",
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Unique key of this request (a UUID): a retry with the same key and body gets the first answer.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "responses": {
          "202": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "client_id": {
                      "type": "string",
                      "description": "The client screened."
                    },
                    "current": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "description": "The id of this request."
                            },
                            "status": {
                              "enum": [
                                "pending",
                                "completed",
                                "failed",
                                "unavailable"
                              ],
                              "type": "string",
                              "description": "`pending`: queued; `completed`: the lists were searched (`outcome`); `failed`: the identity could not be searched (`error_code`); `unavailable`: the lists could not be searched for now, retried later by LexOpti."
                            },
                            "outcome": {
                              "anyOf": [
                                {
                                  "enum": [
                                    "no_match",
                                    "possible_match"
                                  ],
                                  "type": "string",
                                  "description": "`no_match`: no match in the lists searched, at the versions stated (never a statement that the client is compliant or not frozen); `possible_match`: at least one listed person or entity may be the client, to verify."
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Set when `status` is `completed`, null otherwise."
                            },
                            "trigger": {
                              "enum": [
                                "initial",
                                "identity_change",
                                "requested",
                                "list_update"
                              ],
                              "type": "string",
                              "description": "`initial`: your application created the client through the API; `identity_change`: your application changed a screened identity field of such a client; `requested`: your application asked for the screening (`POST /v1/clients/{id}/preliminary-screening`); `list_update`: a new publication of the lists changed the result."
                            },
                            "requested_at": {
                              "type": "string",
                              "format": "date-time",
                              "description": "When the screening was asked for."
                            },
                            "screened_at": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "When the search ran; null when none ran (`pending`, `unavailable`, or an identity that could not be searched)."
                            },
                            "checked_at": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Last time this result was confirmed against a publication of the lists; null unless `completed`."
                            },
                            "error_code": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Why it is `failed` or `unavailable`: `unscreenable_subject` (no name or identifier to search), `saturated` (too many candidates to declare the client clear), `lists_not_indexed` (the lists are not searchable yet), `yente_unavailable` (the search service did not answer), `screening_timeout` (the search could not run in time), `sandbox_error` (the sandbox's `ERREUR`). New codes may be added."
                            },
                            "lists": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "source": {
                                    "enum": [
                                      "fr_tresor_gels",
                                      "eu_fsf",
                                      "us_ofac_sdn"
                                    ],
                                    "type": "string",
                                    "description": "`fr_tresor_gels`: the French national asset-freeze register (kept by the DG Trésor, the French Treasury), binding; `eu_fsf`: the EU consolidated financial sanctions list, binding; `us_ofac_sdn`: the US OFAC SDN list, information on a US sanctions risk only, with no legal effect in France."
                                  },
                                  "binding": {
                                    "type": "boolean",
                                    "description": "A freeze list that binds in France (`fr_tresor_gels`, `eu_fsf`); false for OFAC."
                                  },
                                  "published_at": {
                                    "type": "string",
                                    "format": "date-time",
                                    "description": "The publication date the list itself states."
                                  },
                                  "publisher": {
                                    "type": "string",
                                    "description": "Who publishes the list: the DG Trésor, the European Commission, the US Treasury's OFAC."
                                  },
                                  "licence": {
                                    "type": "string",
                                    "description": "The reuse terms of the list: Licence Ouverte / Open Licence 2.0 (Etalab) for the French register, Commission Decision 2011/833/EU for the EU list, public domain (US government work) for OFAC."
                                  },
                                  "licence_url": {
                                    "type": "string",
                                    "description": "The text of those reuse terms."
                                  },
                                  "attribution": {
                                    "type": "string",
                                    "description": "The source statement to show beside a result built on the list (its publisher, licence and publication date), in the language of the request: the reuse terms of the French register and of the EU list require it."
                                  }
                                },
                                "required": [
                                  "source",
                                  "binding",
                                  "published_at",
                                  "publisher",
                                  "licence",
                                  "licence_url",
                                  "attribution"
                                ]
                              },
                              "description": "The lists searched and the publication of each, empty when no search ran: a result is only valid for these versions."
                            },
                            "matches": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "source": {
                                    "enum": [
                                      "fr_tresor_gels",
                                      "eu_fsf",
                                      "us_ofac_sdn"
                                    ],
                                    "type": "string",
                                    "description": "`fr_tresor_gels`: the French national asset-freeze register (kept by the DG Trésor, the French Treasury), binding; `eu_fsf`: the EU consolidated financial sanctions list, binding; `us_ofac_sdn`: the US OFAC SDN list, information on a US sanctions risk only, with no legal effect in France."
                                  },
                                  "binding": {
                                    "type": "boolean",
                                    "description": "A match on a binding freeze list: verify the identity and, if it is the designated person, freeze and report to the DG Trésor without delay. False for OFAC: a US sanctions risk to assess."
                                  },
                                  "listed_name": {
                                    "type": "string",
                                    "description": "The name as the list writes it."
                                  },
                                  "matched_name": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "The listed name or alias the client's identity matched."
                                  },
                                  "score": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1,
                                    "description": "How close the listed name is to the client's, from 0 to 1 (1: the same name). Names are compared loosely, to catch spelling variants."
                                  },
                                  "birth_dates": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    },
                                    "description": "`YYYY`, `YYYY-MM` or `YYYY-MM-DD`. An approximate date of the list (circa, a range of years) is spread over every year it may stand for."
                                  },
                                  "birth_dates_approximate": {
                                    "type": "boolean",
                                    "description": "The list states an approximate birth date (circa, a range of years, another calendar): the client's birth date never makes such a match a namesake."
                                  },
                                  "nationalities": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    },
                                    "description": "ISO 3166-1 alpha-2 codes."
                                  },
                                  "regime": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Sanctions regime or program."
                                  },
                                  "legal_basis": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "The act the listing rests on."
                                  },
                                  "official_reference": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "The entry's reference in its list."
                                  },
                                  "listed_at": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "First listing date (`YYYY-MM-DD`) when the list states it."
                                  },
                                  "source_url": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "The official page of the entry or of its legal act."
                                  },
                                  "homonym": {
                                    "type": "boolean",
                                    "description": "A probable namesake: the client's birth date contradicts every exact birth date of the listing. Shown, never counted in `outcome`."
                                  }
                                },
                                "required": [
                                  "source",
                                  "binding",
                                  "listed_name",
                                  "matched_name",
                                  "score",
                                  "birth_dates",
                                  "birth_dates_approximate",
                                  "nationalities",
                                  "regime",
                                  "legal_basis",
                                  "official_reference",
                                  "listed_at",
                                  "source_url",
                                  "homonym"
                                ]
                              },
                              "description": "Binding lists first, then by score."
                            }
                          },
                          "required": [
                            "id",
                            "status",
                            "outcome",
                            "trigger",
                            "requested_at",
                            "screened_at",
                            "checked_at",
                            "error_code",
                            "lists",
                            "matches"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The current result: the latest completed search, which a newer pending or unanswered request never hides. Null while the client has none."
                    },
                    "latest": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "The id of this request."
                        },
                        "status": {
                          "enum": [
                            "pending",
                            "completed",
                            "failed",
                            "unavailable"
                          ],
                          "type": "string",
                          "description": "`pending`: queued; `completed`: the lists were searched (`outcome`); `failed`: the identity could not be searched (`error_code`); `unavailable`: the lists could not be searched for now, retried later by LexOpti."
                        },
                        "outcome": {
                          "anyOf": [
                            {
                              "enum": [
                                "no_match",
                                "possible_match"
                              ],
                              "type": "string",
                              "description": "`no_match`: no match in the lists searched, at the versions stated (never a statement that the client is compliant or not frozen); `possible_match`: at least one listed person or entity may be the client, to verify."
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Set when `status` is `completed`, null otherwise."
                        },
                        "trigger": {
                          "enum": [
                            "initial",
                            "identity_change",
                            "requested",
                            "list_update"
                          ],
                          "type": "string",
                          "description": "`initial`: your application created the client through the API; `identity_change`: your application changed a screened identity field of such a client; `requested`: your application asked for the screening (`POST /v1/clients/{id}/preliminary-screening`); `list_update`: a new publication of the lists changed the result."
                        },
                        "requested_at": {
                          "type": "string",
                          "format": "date-time",
                          "description": "When the screening was asked for."
                        },
                        "screened_at": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "When the search ran; null when none ran (`pending`, `unavailable`, or an identity that could not be searched)."
                        },
                        "checked_at": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Last time this result was confirmed against a publication of the lists; null unless `completed`."
                        },
                        "error_code": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Why it is `failed` or `unavailable`: `unscreenable_subject` (no name or identifier to search), `saturated` (too many candidates to declare the client clear), `lists_not_indexed` (the lists are not searchable yet), `yente_unavailable` (the search service did not answer), `screening_timeout` (the search could not run in time), `sandbox_error` (the sandbox's `ERREUR`). New codes may be added."
                        },
                        "lists": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "enum": [
                                  "fr_tresor_gels",
                                  "eu_fsf",
                                  "us_ofac_sdn"
                                ],
                                "type": "string",
                                "description": "`fr_tresor_gels`: the French national asset-freeze register (kept by the DG Trésor, the French Treasury), binding; `eu_fsf`: the EU consolidated financial sanctions list, binding; `us_ofac_sdn`: the US OFAC SDN list, information on a US sanctions risk only, with no legal effect in France."
                              },
                              "binding": {
                                "type": "boolean",
                                "description": "A freeze list that binds in France (`fr_tresor_gels`, `eu_fsf`); false for OFAC."
                              },
                              "published_at": {
                                "type": "string",
                                "format": "date-time",
                                "description": "The publication date the list itself states."
                              },
                              "publisher": {
                                "type": "string",
                                "description": "Who publishes the list: the DG Trésor, the European Commission, the US Treasury's OFAC."
                              },
                              "licence": {
                                "type": "string",
                                "description": "The reuse terms of the list: Licence Ouverte / Open Licence 2.0 (Etalab) for the French register, Commission Decision 2011/833/EU for the EU list, public domain (US government work) for OFAC."
                              },
                              "licence_url": {
                                "type": "string",
                                "description": "The text of those reuse terms."
                              },
                              "attribution": {
                                "type": "string",
                                "description": "The source statement to show beside a result built on the list (its publisher, licence and publication date), in the language of the request: the reuse terms of the French register and of the EU list require it."
                              }
                            },
                            "required": [
                              "source",
                              "binding",
                              "published_at",
                              "publisher",
                              "licence",
                              "licence_url",
                              "attribution"
                            ]
                          },
                          "description": "The lists searched and the publication of each, empty when no search ran: a result is only valid for these versions."
                        },
                        "matches": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "enum": [
                                  "fr_tresor_gels",
                                  "eu_fsf",
                                  "us_ofac_sdn"
                                ],
                                "type": "string",
                                "description": "`fr_tresor_gels`: the French national asset-freeze register (kept by the DG Trésor, the French Treasury), binding; `eu_fsf`: the EU consolidated financial sanctions list, binding; `us_ofac_sdn`: the US OFAC SDN list, information on a US sanctions risk only, with no legal effect in France."
                              },
                              "binding": {
                                "type": "boolean",
                                "description": "A match on a binding freeze list: verify the identity and, if it is the designated person, freeze and report to the DG Trésor without delay. False for OFAC: a US sanctions risk to assess."
                              },
                              "listed_name": {
                                "type": "string",
                                "description": "The name as the list writes it."
                              },
                              "matched_name": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The listed name or alias the client's identity matched."
                              },
                              "score": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1,
                                "description": "How close the listed name is to the client's, from 0 to 1 (1: the same name). Names are compared loosely, to catch spelling variants."
                              },
                              "birth_dates": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "`YYYY`, `YYYY-MM` or `YYYY-MM-DD`. An approximate date of the list (circa, a range of years) is spread over every year it may stand for."
                              },
                              "birth_dates_approximate": {
                                "type": "boolean",
                                "description": "The list states an approximate birth date (circa, a range of years, another calendar): the client's birth date never makes such a match a namesake."
                              },
                              "nationalities": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "ISO 3166-1 alpha-2 codes."
                              },
                              "regime": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Sanctions regime or program."
                              },
                              "legal_basis": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The act the listing rests on."
                              },
                              "official_reference": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The entry's reference in its list."
                              },
                              "listed_at": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "First listing date (`YYYY-MM-DD`) when the list states it."
                              },
                              "source_url": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The official page of the entry or of its legal act."
                              },
                              "homonym": {
                                "type": "boolean",
                                "description": "A probable namesake: the client's birth date contradicts every exact birth date of the listing. Shown, never counted in `outcome`."
                              }
                            },
                            "required": [
                              "source",
                              "binding",
                              "listed_name",
                              "matched_name",
                              "score",
                              "birth_dates",
                              "birth_dates_approximate",
                              "nationalities",
                              "regime",
                              "legal_basis",
                              "official_reference",
                              "listed_at",
                              "source_url",
                              "homonym"
                            ]
                          },
                          "description": "Binding lists first, then by score."
                        }
                      },
                      "required": [
                        "id",
                        "status",
                        "outcome",
                        "trigger",
                        "requested_at",
                        "screened_at",
                        "checked_at",
                        "error_code",
                        "lists",
                        "matches"
                      ],
                      "description": "The latest request, whatever its status; the same as `current` once it completed."
                    }
                  },
                  "required": [
                    "client_id",
                    "current",
                    "latest"
                  ],
                  "description": "The client's free preliminary screening against the official freeze and sanctions lists. It covers freezes and sanctions only, with fuzzy matching, never the whole due diligence: open a case and launch a check for the complete analysis."
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs (`idempotency_request_in_progress`), or a preliminary screening of this client is already running (`preliminary_screening_pending`): read its result once it settled, or ask again then.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Preliminary screening is not available on this deployment, or its official lists are not loaded yet (`preliminary_screening_unavailable`): nothing was asked, retry later.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\n// A client created in LexOpti and linked to your reference, or whose\n// identity changed outside your application: LexOpti screens the clients\n// you create through the API by itself.\nconst screening = await lexopti.clients.requestPreliminaryScreening({\n\tid: \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\",\n});\n// The new request is pending; the previous result, if any, stays current\n// until it settles (client.preliminary_screening_completed).\nconsole.log(screening.latest.status, screening.latest.trigger);\nconsole.log(screening.current?.outcome ?? \"no result yet\");"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST \"https://app.lexopti.com/v1/clients/:id/preliminary-screening\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{}'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('POST', 'https://app.lexopti.com/v1/clients/:id/preliminary-screening', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [],\n]);"
          }
        ]
      }
    },
    "/clients/{id}/external-ref": {
      "put": {
        "operationId": "clients.setExternalRef",
        "summary": "Set the client's reference",
        "description": "Links the client to your own id, replacing your previous one; the same reference again changes nothing. A reference already naming another client answers 409 `external_ref_conflict`. Visible to your application only.",
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "external_ref": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                    "description": "Your own id for the record, e.g. `crm:contact:1042`: 1 to 255 characters among `A-Z a-z 0-9 : . _ -`, unique per application, organization and kind (client or case). An opaque technical id, never personal data (no name, birth date, e-mail…). Visible to your application only."
                  }
                },
                "required": [
                  "external_ref"
                ]
              },
              "examples": {
                "your_contact_s_id": {
                  "summary": "Your contact's id",
                  "value": {
                    "external_ref": "crm:contact:1042"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Client"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `external_ref` already names another client of your application (`external_ref_conflict`): find it with `GET /v1/clients?external_ref=`.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst client = await lexopti.clients.setExternalRef({\n\tid: \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\",\n\texternal_ref: \"crm:contact:1042\",\n});\nconst page = await lexopti.clients.list({ external_ref: \"crm:contact:1042\" });\nconsole.log(client.external_ref, page.data[0]?.id);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X PUT \"https://app.lexopti.com/v1/clients/:id/external-ref\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n    \"external_ref\": \"crm:contact:1042\"\n  }'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('PUT', 'https://app.lexopti.com/v1/clients/:id/external-ref', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [\n        'external_ref' => 'crm:contact:1042',\n    ],\n]);"
          }
        ]
      },
      "delete": {
        "operationId": "clients.deleteExternalRef",
        "summary": "Remove the client's reference",
        "description": "Unlinks the client from your reference, which may then name another client. Idempotent: a client without a reference answers the same. Other applications' references stay.",
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Client"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst client = await lexopti.clients.deleteExternalRef({\n\tid: \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\",\n});\nconsole.log(client.external_ref);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X DELETE \"https://app.lexopti.com/v1/clients/:id/external-ref\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('DELETE', 'https://app.lexopti.com/v1/clients/:id/external-ref', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/organization": {
      "get": {
        "operationId": "organization.get",
        "summary": "Get the current organization",
        "description": "The organization the access token is bound to and the member it acts for. Use it to test a connection.",
        "tags": [
          "Organization"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Organization id."
                    },
                    "name": {
                      "type": "string"
                    },
                    "sandbox": {
                      "type": "boolean",
                      "description": "A sandbox organization: fixture data, no billing, no outbound effect."
                    },
                    "member": {
                      "type": "object",
                      "properties": {
                        "user_id": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string",
                          "description": "The member's role: `owner`, `admin`, `member` or `readonly`."
                        }
                      },
                      "required": [
                        "user_id",
                        "role"
                      ],
                      "description": "The member the token acts for."
                    },
                    "integration": {
                      "type": "object",
                      "properties": {
                        "client_id": {
                          "type": "string"
                        },
                        "delegated_mode": {
                          "type": "boolean",
                          "description": "Whether the organization lets your application act for the members it enrolled without their sign-in, naming the acting member with `X-LexOpti-Acting-User` (on by default for an installed application; LexOpti turns it off at the organization's request). False as well when your application is not installed for the whole organization."
                        }
                      },
                      "required": [
                        "client_id",
                        "delegated_mode"
                      ],
                      "description": "The OAuth client making the call."
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "sandbox",
                    "member",
                    "integration"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst organization = await lexopti.organization.get();\nconsole.log(\n\torganization.name,\n\torganization.sandbox,\n\torganization.member.role\n);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/organization\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/organization', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/members": {
      "get": {
        "operationId": "members.list",
        "summary": "List members",
        "description": "The organization's members, newest first: id, name, email and role, nothing else. Only for an application an owner or admin installed for the whole organization (403 `installation_required` otherwise): map your own users to them (the people using your software); each member still signs in to get their own token, with their own rights.",
        "tags": [
          "Organization"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "description": "Page size, 1 to 100."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Page size, 1 to 100."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "`next_cursor` of the previous page; omit for the first page."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "`next_cursor` of the previous page; omit for the first page."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "The member's user id: the `member.user_id` that `GET /v1/organization` answers for a token acting for them."
                          },
                          "name": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string",
                            "description": "The address the member signs in with."
                          },
                          "role": {
                            "type": "string",
                            "description": "The member's role: `owner`, `admin`, `member` or `readonly`."
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "email",
                          "role"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Pass it as `cursor` to read the next page; null on the last one."
                    }
                  },
                  "required": [
                    "data",
                    "has_more",
                    "next_cursor"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), or your application is not installed for the whole organization (`installation_required`): an owner or admin installs it first, from their consent or LexOpti's connected applications.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst memberIdByEmail = new Map<string, string>();\nlet cursor: string | undefined;\ndo {\n\tconst page = await lexopti.members.list({ limit: 100, cursor });\n\tfor (const member of page.data) {\n\t\tmemberIdByEmail.set(member.email.toLowerCase(), member.id);\n\t}\n\tcursor = page.next_cursor ?? undefined;\n} while (cursor !== undefined);\nconsole.log(memberIdByEmail.size, \"members\");"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/members\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/members', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/members/enrolments": {
      "post": {
        "operationId": "enrolments.create",
        "summary": "Enrol a member",
        "description": "Names a person of the organization who will work in LexOpti through your application, as an owner or admin of the organization decides it (the token must be theirs: 403 `owner_or_admin_required` otherwise), for an application installed for the whole organization (403 `installation_required`). LexOpti creates their account at once if the address has none, decides their membership with the role you give (`member` or `readonly`, never more), e-mails them that their access was prepared, and activates everything at their first e-mail code: from your software, with `lexopti_hint` carrying their address, they type that code and nothing else, and come back with their own token. An address already a member answers 409 `already_member`; one already enrolled and waiting, 409 `enrolment_pending`; an organization at its seat limit, 402 `seat_limit_reached`. Sends `member.enrolled`, then `member.joined` at activation. Requires an `Idempotency-Key`.",
        "tags": [
          "Organization"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "maxLength": 254,
                    "format": "email",
                    "description": "The person's address, the one they will sign in with: the code goes there, and the enrolment is activated by it."
                  },
                  "first_name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "pattern": "^[^\\u0000-\\u001F\\u007F-\\u009F]*$",
                    "description": "Their first name, for the account LexOpti creates; they can change it."
                  },
                  "last_name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "pattern": "^[^\\u0000-\\u001F\\u007F-\\u009F]*$",
                    "description": "Their last name, likewise."
                  },
                  "role": {
                    "enum": [
                      "member",
                      "readonly"
                    ],
                    "type": "string",
                    "default": "member",
                    "description": "Their role in the organization: `member` (works on clients and cases) or `readonly`. Owners and admins are named in LexOpti, never through a partner."
                  },
                  "external_ref": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9:._-]{1,255}$",
                    "description": "Your own id of the person (e.g. `crm:user:42`): 1 to 255 characters among `A-Z a-z 0-9 : . _ -`. An opaque technical id, never personal data. Visible to your application only."
                  },
                  "locale": {
                    "enum": [
                      "fr",
                      "en"
                    ],
                    "type": "string",
                    "description": "The language of the e-mail telling them; `fr` by default."
                  }
                },
                "required": [
                  "email"
                ],
                "additionalProperties": false
              },
              "examples": {
                "a_member_of_the_organization": {
                  "summary": "A member of the organization",
                  "value": {
                    "email": "camille.durand@durand-conseil.fr",
                    "first_name": "Camille",
                    "last_name": "Durand",
                    "role": "member",
                    "external_ref": "crm:user:42"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The enrolment's id (`enr_…`), for `DELETE /v1/members/enrolments/{id}`."
                    },
                    "email": {
                      "type": "string",
                      "description": "The person's address, as you sent it."
                    },
                    "first_name": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Their first name, as you sent it; null when you sent none."
                    },
                    "last_name": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Their last name, as you sent it; null when you sent none."
                    },
                    "role": {
                      "enum": [
                        "member",
                        "readonly"
                      ],
                      "type": "string",
                      "description": "Their role in the organization: `member` (works on clients and cases) or `readonly` (reads only)."
                    },
                    "external_ref": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Your own id of the person, as you sent it; null when you sent none."
                    },
                    "status": {
                      "enum": [
                        "pending",
                        "activated",
                        "expired",
                        "cancelled"
                      ],
                      "type": "string",
                      "description": "`pending` until the person's first e-mail code; `activated` once they are a member (`member_id` then names them, the `id` of `GET /v1/members`); `expired` thirty days after the enrolment without a code; `cancelled` by your application."
                    },
                    "member_id": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The member's user id once activated, null before."
                    },
                    "enrolled_by": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The user id of the owner or admin who asked."
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When it was created (ISO 8601, UTC)."
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When the enrolment expires if the person has not typed their first code: thirty days after it was made."
                    },
                    "activated_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When the person typed their first code and became a member; null before."
                    },
                    "connect_hint": {
                      "type": "string",
                      "description": "The `lexopti_hint` value to put on this person's « Connecter LexOpti » button: their address, so the sign-in starts with it. Hints only; the code does the rest."
                    }
                  },
                  "required": [
                    "id",
                    "email",
                    "first_name",
                    "last_name",
                    "role",
                    "external_ref",
                    "status",
                    "member_id",
                    "enrolled_by",
                    "created_at",
                    "expires_at",
                    "activated_at",
                    "connect_hint"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Unique key of this request (a UUID): a retry with the same key and body gets the first answer.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst enrolment = await lexopti.enrolments.create({\n\temail: \"camille.durand@agence.example\",\n\tfirst_name: \"Camille\",\n\tlast_name: \"Durand\",\n\trole: \"member\",\n\texternal_ref: \"crm:user:42\",\n});\n// Put `connect_hint` in `lexopti_hint` on this agent's « Connecter LexOpti »\n// button: their address is prefilled, the code does the rest.\nconsole.log(enrolment.status, enrolment.connect_hint);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST \"https://app.lexopti.com/v1/members/enrolments\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n    \"email\": \"camille.durand@durand-conseil.fr\",\n    \"first_name\": \"Camille\",\n    \"last_name\": \"Durand\",\n    \"role\": \"member\",\n    \"external_ref\": \"crm:user:42\"\n  }'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('POST', 'https://app.lexopti.com/v1/members/enrolments', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [\n        'email' => 'camille.durand@durand-conseil.fr',\n        'first_name' => 'Camille',\n        'last_name' => 'Durand',\n        'role' => 'member',\n        'external_ref' => 'crm:user:42',\n    ],\n]);"
          }
        ]
      },
      "get": {
        "operationId": "enrolments.list",
        "summary": "List enrolments",
        "description": "The people your application enrolled in the organization, newest first, with their state: `pending` until their first code, `activated` (with the member's id), `expired` after thirty days, `cancelled`. Only for an application installed for the whole organization.",
        "tags": [
          "Organization"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "description": "Page size, 1 to 100."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Page size, 1 to 100."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "`next_cursor` of the previous page; omit for the first page."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "`next_cursor` of the previous page; omit for the first page."
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "enum": [
                "pending",
                "activated",
                "expired",
                "cancelled"
              ],
              "type": "string",
              "description": "Only the enrolments in this state: `pending`, `activated`, `expired` or `cancelled`. Omitted: all of them."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Only the enrolments in this state: `pending`, `activated`, `expired` or `cancelled`. Omitted: all of them."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "The enrolment's id (`enr_…`), for `DELETE /v1/members/enrolments/{id}`."
                          },
                          "email": {
                            "type": "string",
                            "description": "The person's address, as you sent it."
                          },
                          "first_name": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Their first name, as you sent it; null when you sent none."
                          },
                          "last_name": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Their last name, as you sent it; null when you sent none."
                          },
                          "role": {
                            "enum": [
                              "member",
                              "readonly"
                            ],
                            "type": "string",
                            "description": "Their role in the organization: `member` (works on clients and cases) or `readonly` (reads only)."
                          },
                          "external_ref": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Your own id of the person, as you sent it; null when you sent none."
                          },
                          "status": {
                            "enum": [
                              "pending",
                              "activated",
                              "expired",
                              "cancelled"
                            ],
                            "type": "string",
                            "description": "`pending` until the person's first e-mail code; `activated` once they are a member (`member_id` then names them, the `id` of `GET /v1/members`); `expired` thirty days after the enrolment without a code; `cancelled` by your application."
                          },
                          "member_id": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The member's user id once activated, null before."
                          },
                          "enrolled_by": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The user id of the owner or admin who asked."
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "When it was created (ISO 8601, UTC)."
                          },
                          "expires_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "When the enrolment expires if the person has not typed their first code: thirty days after it was made."
                          },
                          "activated_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "When the person typed their first code and became a member; null before."
                          },
                          "connect_hint": {
                            "type": "string",
                            "description": "The `lexopti_hint` value to put on this person's « Connecter LexOpti » button: their address, so the sign-in starts with it. Hints only; the code does the rest."
                          }
                        },
                        "required": [
                          "id",
                          "email",
                          "first_name",
                          "last_name",
                          "role",
                          "external_ref",
                          "status",
                          "member_id",
                          "enrolled_by",
                          "created_at",
                          "expires_at",
                          "activated_at",
                          "connect_hint"
                        ]
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Pass it as `cursor` to read the next page; null on the last one."
                    }
                  },
                  "required": [
                    "data",
                    "has_more",
                    "next_cursor"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst waiting = await lexopti.enrolments.list({\n\tlimit: 100,\n\tstatus: \"pending\",\n});\nfor (const enrolment of waiting.data) {\n\tconsole.log(enrolment.email, \"has not signed in yet\");\n}"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/members/enrolments\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/members/enrolments', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/members/enrolments/{id}": {
      "delete": {
        "operationId": "enrolments.cancel",
        "summary": "Cancel an enrolment",
        "description": "Cancels an enrolment still waiting for the person's first code: their membership will not be created. An owner or admin of the organization only. An activated enrolment cannot be cancelled: remove the member in LexOpti.",
        "tags": [
          "Organization"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The enrolment's id (`enr_…`), as its creation or `GET /v1/members/enrolments` answered it."
            },
            "description": "The enrolment's id (`enr_…`), as its creation or `GET /v1/members/enrolments` answered it."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The enrolment's id (`enr_…`)."
                    },
                    "status": {
                      "const": "cancelled",
                      "description": "Always `cancelled`."
                    }
                  },
                  "required": [
                    "id",
                    "status"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst cancelled = await lexopti.enrolments.cancel({\n\tid: \"enr_3fQm9zX1b2c4d5e6\",\n});\nconsole.log(cancelled.status);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X DELETE \"https://app.lexopti.com/v1/members/enrolments/:id\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('DELETE', 'https://app.lexopti.com/v1/members/enrolments/:id', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/webhook-endpoints": {
      "post": {
        "operationId": "webhookEndpoints.create",
        "summary": "Subscribe a webhook endpoint",
        "description": "Subscribes a URL to event types of the organization, for this application. The answer carries the signing secret, once: a retry with the same `Idempotency-Key` gets `idempotency_secret_withheld` (409) naming the endpoint, whose secret you then rotate. Requires an `Idempotency-Key`.",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "HTTPS URL on a public hostname, where LexOpti sends the events. Example: `https://crm.example.com/webhooks/lexopti`."
                  },
                  "event_types": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "x-extensible-enum": [
                        "check.completed",
                        "check.failed",
                        "client.created",
                        "client.updated",
                        "client.vigilance_level_changed",
                        "client.risk_level_changed",
                        "client.preliminary_screening_completed",
                        "classification.validated",
                        "case.created",
                        "case.updated",
                        "case.risk_level_changed",
                        "report.generated",
                        "alert.created",
                        "alert.resolved",
                        "decision.pending",
                        "quota.exhausted",
                        "subscription.inactive",
                        "access.revoked",
                        "member.enrolled",
                        "member.joined"
                      ],
                      "type": "string",
                      "description": "One of the catalog's event types (the `webhooks` section of this document). New types may be added: ignore those you do not handle."
                    },
                    "description": "The event types to receive, at least one (the `webhooks` section of this document lists them). Example: `[\"check.completed\", \"alert.created\"]`."
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "Your label for the endpoint, 200 characters at most. Example: `LexOpti sync`."
                  }
                },
                "required": [
                  "url",
                  "event_types"
                ]
              },
              "examples": {
                "checks_and_alerts": {
                  "summary": "Checks and alerts",
                  "value": {
                    "url": "https://crm.example.com/webhooks/lexopti",
                    "event_types": [
                      "check.completed",
                      "check.failed",
                      "alert.created"
                    ],
                    "description": "LexOpti sync"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The endpoint's LexOpti id."
                    },
                    "url": {
                      "type": "string",
                      "format": "uri",
                      "description": "Where LexOpti sends the events."
                    },
                    "description": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Your label for the endpoint."
                    },
                    "event_types": {
                      "type": "array",
                      "items": {
                        "x-extensible-enum": [
                          "check.completed",
                          "check.failed",
                          "client.created",
                          "client.updated",
                          "client.vigilance_level_changed",
                          "client.risk_level_changed",
                          "client.preliminary_screening_completed",
                          "classification.validated",
                          "case.created",
                          "case.updated",
                          "case.risk_level_changed",
                          "report.generated",
                          "alert.created",
                          "alert.resolved",
                          "decision.pending",
                          "quota.exhausted",
                          "subscription.inactive",
                          "access.revoked",
                          "member.enrolled",
                          "member.joined"
                        ],
                        "type": "string",
                        "description": "One of the catalog's event types (the `webhooks` section of this document). New types may be added: ignore those you do not handle."
                      },
                      "description": "The event types it receives."
                    },
                    "status": {
                      "enum": [
                        "enabled",
                        "disabled"
                      ],
                      "type": "string",
                      "description": "`disabled`: LexOpti sends nothing; `disabled_reason` says why."
                    },
                    "disabled_reason": {
                      "anyOf": [
                        {
                          "x-extensible-enum": [
                            "failing",
                            "member",
                            "access_revoked"
                          ],
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "`failing`: every delivery failed for a whole retry schedule (about three days); enable it again once fixed. `member`: disabled with `PATCH`. `access_revoked`: your application lost its access to the organization, told by a last `access.revoked` delivery; enable it again once a member authorized it again."
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When it was created (ISO 8601, UTC)."
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When it last changed (ISO 8601, UTC)."
                    },
                    "secret": {
                      "type": "string",
                      "description": "Signing secret (`whsec_…`), shown only once: store it to verify the `webhook-signature` header."
                    }
                  },
                  "required": [
                    "id",
                    "url",
                    "description",
                    "event_types",
                    "status",
                    "disabled_reason",
                    "created_at",
                    "updated_at",
                    "secret"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Unique key of this request (a UUID): a retry with the same key and body gets the first answer.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\n// Placeholder: your secret manager's client (Vault, AWS Secrets Manager…).\nconst secretManager = {\n\tsave: (_name: string, _secret: string) => Promise.resolve(),\n};\nconst endpoint = await lexopti.webhookEndpoints.create({\n\turl: \"https://crm.example.com/lexopti/webhooks\",\n\tevent_types: [\"check.completed\", \"alert.created\"],\n});\n// Answered once: keep it in your secret manager, never in a log.\nawait secretManager.save(\"lexopti-webhook-secret\", endpoint.secret);\nconsole.log(endpoint.id);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST \"https://app.lexopti.com/v1/webhook-endpoints\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n    \"url\": \"https://crm.example.com/webhooks/lexopti\",\n    \"event_types\": [\n      \"check.completed\",\n      \"check.failed\",\n      \"alert.created\"\n    ],\n    \"description\": \"LexOpti sync\"\n  }'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('POST', 'https://app.lexopti.com/v1/webhook-endpoints', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [\n        'url' => 'https://crm.example.com/webhooks/lexopti',\n        'event_types' => [\n            'check.completed',\n            'check.failed',\n            'alert.created',\n        ],\n        'description' => 'LexOpti sync',\n    ],\n]);"
          }
        ]
      },
      "get": {
        "operationId": "webhookEndpoints.list",
        "summary": "List webhook endpoints",
        "description": "This application's endpoints in the organization.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "description": "Page size, 1 to 100."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Page size, 1 to 100."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "`next_cursor` of the previous page; omit for the first page."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "`next_cursor` of the previous page; omit for the first page."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WebhookEndpoint"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Pass it as `cursor` to read the next page; null on the last one."
                    }
                  },
                  "required": [
                    "data",
                    "has_more",
                    "next_cursor"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst page = await lexopti.webhookEndpoints.list({});\nconsole.log(page.data.map((endpoint) => endpoint.url));"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/webhook-endpoints\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/webhook-endpoints', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/webhook-endpoints/{id}": {
      "get": {
        "operationId": "webhookEndpoints.get",
        "summary": "Get a webhook endpoint",
        "description": "One endpoint of this application in the organization, without its secret.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst endpoint = await lexopti.webhookEndpoints.get({\n\tid: \"5e2a9c1d-7f3b-4a68-9d0e-2b1c4f6a8e3d\",\n});\nconsole.log(endpoint.status, endpoint.event_types);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/webhook-endpoints/:id\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/webhook-endpoints/:id', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      },
      "patch": {
        "operationId": "webhookEndpoints.update",
        "summary": "Update a webhook endpoint",
        "description": "Changes the URL, the event types or the description, or enables or disables the endpoint.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "HTTPS URL on a public hostname, where LexOpti sends the events. Example: `https://crm.example.com/webhooks/lexopti`."
                  },
                  "event_types": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "x-extensible-enum": [
                        "check.completed",
                        "check.failed",
                        "client.created",
                        "client.updated",
                        "client.vigilance_level_changed",
                        "client.risk_level_changed",
                        "client.preliminary_screening_completed",
                        "classification.validated",
                        "case.created",
                        "case.updated",
                        "case.risk_level_changed",
                        "report.generated",
                        "alert.created",
                        "alert.resolved",
                        "decision.pending",
                        "quota.exhausted",
                        "subscription.inactive",
                        "access.revoked",
                        "member.enrolled",
                        "member.joined"
                      ],
                      "type": "string",
                      "description": "One of the catalog's event types (the `webhooks` section of this document). New types may be added: ignore those you do not handle."
                    },
                    "description": "The event types to receive, at least one (the `webhooks` section of this document lists them). Example: `[\"check.completed\", \"alert.created\"]`. Replaces the whole list."
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Your label for the endpoint, 200 characters at most. Example: `LexOpti sync`. `null` clears it."
                  },
                  "enabled": {
                    "type": "boolean",
                    "description": "`true` enables a disabled endpoint again and clears its failure streak."
                  }
                }
              },
              "examples": {
                "enable_again_checks_only": {
                  "summary": "Enable again, checks only",
                  "value": {
                    "event_types": [
                      "check.completed",
                      "check.failed"
                    ],
                    "enabled": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst endpoint = await lexopti.webhookEndpoints.update({\n\tid: \"5e2a9c1d-7f3b-4a68-9d0e-2b1c4f6a8e3d\",\n\tevent_types: [\"check.completed\", \"check.failed\"],\n\tenabled: true,\n});\nconsole.log(endpoint.event_types);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X PATCH \"https://app.lexopti.com/v1/webhook-endpoints/:id\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n    \"event_types\": [\n      \"check.completed\",\n      \"check.failed\"\n    ],\n    \"enabled\": true\n  }'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('PATCH', 'https://app.lexopti.com/v1/webhook-endpoints/:id', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [\n        'event_types' => [\n            'check.completed',\n            'check.failed',\n        ],\n        'enabled' => true,\n    ],\n]);"
          }
        ]
      },
      "delete": {
        "operationId": "webhookEndpoints.delete",
        "summary": "Unsubscribe a webhook endpoint",
        "description": "Deletes the endpoint and its pending deliveries. Idempotent: an endpoint already deleted, or unknown to the organization, answers the same, so a retry is safe.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "deleted": {
                      "const": true
                    }
                  },
                  "required": [
                    "id",
                    "deleted"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst deleted = await lexopti.webhookEndpoints.delete({\n\tid: \"5e2a9c1d-7f3b-4a68-9d0e-2b1c4f6a8e3d\",\n});\nconsole.log(deleted.deleted);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X DELETE \"https://app.lexopti.com/v1/webhook-endpoints/:id\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('DELETE', 'https://app.lexopti.com/v1/webhook-endpoints/:id', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/webhook-endpoints/{id}/rotate-secret": {
      "post": {
        "operationId": "webhookEndpoints.rotateSecret",
        "summary": "Rotate the signing secret",
        "description": "A new secret signs every delivery from now on; the previous ones keep signing for 24 hours, so deliveries carry several signatures meanwhile.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "secret": {
                      "type": "string",
                      "description": "The new signing secret. The previous ones keep signing for 24 hours."
                    }
                  },
                  "required": [
                    "secret"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\n// Placeholder: your secret manager's client (Vault, AWS Secrets Manager…).\nconst secretManager = {\n\tsave: (_name: string, _secret: string) => Promise.resolve(),\n};\nconst { secret } = await lexopti.webhookEndpoints.rotateSecret({\n\tid: \"5e2a9c1d-7f3b-4a68-9d0e-2b1c4f6a8e3d\",\n});\n// Verify with both secrets until the old one expires, then drop it.\nawait secretManager.save(\"lexopti-webhook-secret\", secret);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST \"https://app.lexopti.com/v1/webhook-endpoints/:id/rotate-secret\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{}'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('POST', 'https://app.lexopti.com/v1/webhook-endpoints/:id/rotate-secret', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [],\n]);"
          }
        ]
      }
    },
    "/webhook-endpoints/{id}/test": {
      "post": {
        "operationId": "webhookEndpoints.test",
        "summary": "Send a test event",
        "description": "Queues a signed `webhook.test` delivery to the endpoint, retried like the others.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          }
        ],
        "responses": {
          "202": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDelivery"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst delivery = await lexopti.webhookEndpoints.test({\n\tid: \"5e2a9c1d-7f3b-4a68-9d0e-2b1c4f6a8e3d\",\n});\nconsole.log(delivery.type, delivery.status);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST \"https://app.lexopti.com/v1/webhook-endpoints/:id/test\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{}'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('POST', 'https://app.lexopti.com/v1/webhook-endpoints/:id/test', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [],\n]);"
          }
        ]
      }
    },
    "/webhook-endpoints/{id}/deliveries": {
      "get": {
        "operationId": "webhookEndpoints.listDeliveries",
        "summary": "List deliveries",
        "description": "The endpoint's deliveries, newest first, with their attempts and last outcome.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "description": "Page size, 1 to 100."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "Page size, 1 to 100."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "`next_cursor` of the previous page; omit for the first page."
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "description": "`next_cursor` of the previous page; omit for the first page."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WebhookDelivery"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Pass it as `cursor` to read the next page; null on the last one."
                    }
                  },
                  "required": [
                    "data",
                    "has_more",
                    "next_cursor"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst page = await lexopti.webhookEndpoints.listDeliveries({\n\tid: \"5e2a9c1d-7f3b-4a68-9d0e-2b1c4f6a8e3d\",\n});\nfor (const delivery of page.data) {\n\tconsole.log(delivery.type, delivery.status, delivery.attempts);\n}"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/webhook-endpoints/:id/deliveries\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/webhook-endpoints/:id/deliveries', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/webhook-endpoints/{id}/deliveries/{delivery_id}/replay": {
      "post": {
        "operationId": "webhookEndpoints.replayDelivery",
        "summary": "Replay a delivery",
        "description": "Sends the same event again, with the same `webhook-id`, as a new delivery.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
            },
            "description": "The LexOpti id, as its creation or a list answered it (find a client or a case by your own reference with `?external_ref=`)."
          },
          {
            "name": "delivery_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The delivery's id, from `GET /v1/webhook-endpoints/{id}/deliveries`."
            },
            "description": "The delivery's id, from `GET /v1/webhook-endpoints/{id}/deliveries`."
          }
        ],
        "responses": {
          "202": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDelivery"
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst delivery = await lexopti.webhookEndpoints.replayDelivery({\n\tid: \"5e2a9c1d-7f3b-4a68-9d0e-2b1c4f6a8e3d\",\n\tdelivery_id: \"d1f2e3a4-b5c6-4d7e-8f90-a1b2c3d4e5f6\",\n});\nconsole.log(delivery.id, delivery.replay_of);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST \"https://app.lexopti.com/v1/webhook-endpoints/:id/deliveries/:delivery_id/replay\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{}'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('POST', 'https://app.lexopti.com/v1/webhook-endpoints/:id/deliveries/:delivery_id/replay', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [],\n]);"
          }
        ]
      }
    },
    "/usage": {
      "get": {
        "operationId": "usage.get",
        "summary": "Get the organization's usage",
        "description": "The organization's credit balance and cases, to warn a member before a check is refused.",
        "tags": [
          "Organization"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "unit": {
                      "const": "credit",
                      "description": "What the figures count: credits. One credit = one case of up to five people or companies for twelve months, renewable."
                    },
                    "credits": {
                      "type": "object",
                      "properties": {
                        "balance": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "description": "Credits the organization can spend now: a check is refused (`quota_exceeded`) when its case needs more."
                        },
                        "frozen": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "description": "Recharge credits kept while no offer runs: spendable again once one does."
                        },
                        "low_balance_threshold": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "description": "From this balance down, LexOpti warns the organization's members: warn yours too."
                        }
                      },
                      "required": [
                        "balance",
                        "frozen",
                        "low_balance_threshold"
                      ]
                    },
                    "dossiers": {
                      "type": "object",
                      "properties": {
                        "active": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "description": "Cases within their paid (or trial) year."
                        },
                        "paused": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "description": "Cases due for renewal without a credit: paused until one arrives."
                        },
                        "renewals_due": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "description": "Running cases whose anniversary falls within 30 days."
                        },
                        "renewal_credits": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "description": "Credits those renewals will take."
                        }
                      },
                      "required": [
                        "active",
                        "paused",
                        "renewals_due",
                        "renewal_credits"
                      ],
                      "description": "The organization's cases, by where their paid year stands (LexOpti calls a case a « dossier »)."
                    },
                    "subscription_active": {
                      "type": "boolean",
                      "description": "An offer runs (a subscription, a paid year still running, a manual grant): credits are spendable and vigilance runs. False: checks are refused (`subscription_inactive`) until the organization subscribes again."
                    },
                    "read_only": {
                      "type": "boolean",
                      "description": "No offer runs and no credit is left: reads work, checks and new clients are refused."
                    }
                  },
                  "required": [
                    "unit",
                    "credits",
                    "dossiers",
                    "subscription_active",
                    "read_only"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:read"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst usage = await lexopti.usage.get();\nconsole.log(usage.credits.balance, usage.dossiers.active);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X GET \"https://app.lexopti.com/v1/usage\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\""
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('GET', 'https://app.lexopti.com/v1/usage', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN')],\n]);"
          }
        ]
      }
    },
    "/sandbox/triggers": {
      "post": {
        "operationId": "sandboxTriggers.create",
        "summary": "Trigger a test event",
        "description": "In a sandbox organization only (403 `sandbox_required` anywhere else): makes a change happen as it would in a real organization, through the same writes, so its events and webhooks come exactly as in production. A vigilance alert or a vigilance level change on a client, the organization's last credit spent or its credits restored, or your application's access revoked.",
        "tags": [
          "Sandbox"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "enum": [
                      "vigilance_alert",
                      "vigilance_level_change",
                      "quota_exhausted",
                      "quota_restored",
                      "access_revoked"
                    ],
                    "type": "string",
                    "description": "`vigilance_alert`: a new adverse media finding on the client raises a pending alert (`alert.created`, and `client.vigilance_level_changed` when the level moves). `vigilance_level_change`: the client's vigilance level moves without an alert, up to `enhanced` or, from `enhanced`, back down (`client.vigilance_level_changed`). `quota_exhausted`: the organization's last credit is spent (`quota.exhausted`), and the sandbox stays without credits: every creation or check that costs is refused with `quota_exceeded`, as for a real organization, until `quota_restored` or a reset. `quota_restored`: the sandbox gets its free credits back; no event. `access_revoked`: your application loses its access to the sandbox for real (every member's consent and token there), then your endpoints receive `access.revoked` and are disabled; this request's token stops working."
                  },
                  "client_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The client concerned, required by `vigilance_alert` and `vigilance_level_change`."
                  }
                },
                "required": [
                  "type"
                ]
              },
              "examples": {
                "an_alert_on_a_client": {
                  "summary": "An alert on a client",
                  "value": {
                    "type": "vigilance_alert",
                    "client_id": "6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "enum": [
                        "vigilance_alert",
                        "vigilance_level_change",
                        "quota_exhausted",
                        "quota_restored",
                        "access_revoked"
                      ],
                      "type": "string",
                      "description": "`vigilance_alert`: a new adverse media finding on the client raises a pending alert (`alert.created`, and `client.vigilance_level_changed` when the level moves). `vigilance_level_change`: the client's vigilance level moves without an alert, up to `enhanced` or, from `enhanced`, back down (`client.vigilance_level_changed`). `quota_exhausted`: the organization's last credit is spent (`quota.exhausted`), and the sandbox stays without credits: every creation or check that costs is refused with `quota_exceeded`, as for a real organization, until `quota_restored` or a reset. `quota_restored`: the sandbox gets its free credits back; no event. `access_revoked`: your application loses its access to the sandbox for real (every member's consent and token there), then your endpoints receive `access.revoked` and are disabled; this request's token stops working."
                    },
                    "client_id": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "The events the trigger leads to, delivered like any other: those written by the change at once, those the dispatcher derives (`client.vigilance_level_changed`, `access.revoked`) within seconds."
                    },
                    "vigilance_level": {
                      "anyOf": [
                        {
                          "enum": [
                            "simplified",
                            "standard",
                            "enhanced"
                          ],
                          "type": "string",
                          "description": "Vigilance level LexOpti derives from the check results: `simplified` (lighter checks), `standard` or `enhanced` (closer checks). It is not the professional's decision, which is `risk_level`. [Glossary](https://developers.lexopti.com/glossary/)."
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The client's vigilance level once the trigger counts."
                    },
                    "livemode": {
                      "const": false,
                      "description": "Always false: triggers run in sandboxes only."
                    }
                  },
                  "required": [
                    "type",
                    "client_id",
                    "events",
                    "vigilance_level",
                    "livemode"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst trigger = await lexopti.sandboxTriggers.create({\n\ttype: \"vigilance_alert\",\n\tclient_id: \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\",\n});\nconsole.log(trigger.events, trigger.vigilance_level);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST \"https://app.lexopti.com/v1/sandbox/triggers\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n    \"type\": \"vigilance_alert\",\n    \"client_id\": \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\"\n  }'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('POST', 'https://app.lexopti.com/v1/sandbox/triggers', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [\n        'type' => 'vigilance_alert',\n        'client_id' => '6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10',\n    ],\n]);"
          }
        ]
      }
    },
    "/deep-links": {
      "post": {
        "operationId": "deepLinks.create",
        "summary": "Create a deep link",
        "description": "A signed link that opens a client or a case in LexOpti, in the right organization. Single use, valid 5 minutes: create it when the member clicks.",
        "tags": [
          "Organization"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The client the link opens. Give it or `case_id`, not both."
                  },
                  "case_id": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The case the link opens. Give it or `client_id`, not both."
                  }
                },
                "description": "What the link opens in LexOpti: exactly one of `client_id` and `case_id`."
              },
              "examples": {
                "open_a_client": {
                  "summary": "Open a client",
                  "value": {
                    "client_id": "6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri",
                      "description": "Opens the client or case in LexOpti for the member, once; a signed-out member signs in, then opens it again."
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "5 minutes after issuance."
                    }
                  },
                  "required": [
                    "url",
                    "expires_at"
                  ]
                }
              }
            },
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              },
              "RateLimit": {
                "description": "Remaining requests and seconds until the window resets.",
                "schema": {
                  "type": "string"
                }
              },
              "RateLimit-Policy": {
                "description": "Requests allowed per window, per application.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid request: `validation_failed` lists the invalid fields.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing, invalid or expired token, or the member's access to the application ended (`invalid_token`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Missing scope (`insufficient_scope`), read-only member (`readonly_member`), or an action the organization's plan refuses.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found in the organization the token is bound to (`not_found`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflict: a request with the same `Idempotency-Key` still runs.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The `Idempotency-Key` was used for another request.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Rate limit reached (`rate_limited`); retry after `Retry-After` seconds.",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unexpected error (`internal_error`).",
            "headers": {
              "Request-Id": {
                "description": "The request's id (`req_` and 32 hexadecimal characters), generated by LexOpti for every request, also the `request_id` of a problem: quote it to LexOpti support.",
                "schema": {
                  "type": "string",
                  "pattern": "^req_[0-9a-f]{32}$"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "lexopti:write"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "typescript",
            "label": "TypeScript",
            "source": "import { createLexOptiClient } from \"@lexopti/sdk\";\n\nconst lexopti = createLexOptiClient({ accessToken: () => process.env.LEXOPTI_TOKEN ?? \"\" });\n\nconst link = await lexopti.deepLinks.create({\n\tclient_id: \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\",\n});\nconsole.log(link.url, link.expires_at);"
          },
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST \"https://app.lexopti.com/v1/deep-links\" \\\n  -H \"Authorization: Bearer $LEXOPTI_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n    \"client_id\": \"6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10\"\n  }'"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "$response = (new GuzzleHttp\\Client())->request('POST', 'https://app.lexopti.com/v1/deep-links', [\n    'headers' => ['Authorization' => 'Bearer ' . getenv('LEXOPTI_TOKEN'), 'Idempotency-Key' => uniqid('', true)],\n    'json' => [\n        'client_id' => '6f1b8d6e-2c4a-4f5e-9b1d-3a7c2e8f4d10',\n    ],\n]);"
          }
        ]
      }
    }
  },
  "webhooks": {
    "check.completed": {
      "post": {
        "summary": "check.completed",
        "description": "Every source of a check answered. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.check.completed",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "check.completed"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "check_id",
                      "client_id"
                    ],
                    "properties": {
                      "check_id": {
                        "type": "string"
                      },
                      "client_id": {
                        "type": "string"
                      },
                      "case_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "check.failed": {
      "post": {
        "summary": "check.failed",
        "description": "A check ended with a source that could not be screened. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.check.failed",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "check.failed"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "check_id",
                      "client_id"
                    ],
                    "properties": {
                      "check_id": {
                        "type": "string"
                      },
                      "client_id": {
                        "type": "string"
                      },
                      "case_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "client.created": {
      "post": {
        "summary": "client.created",
        "description": "A client was created: in LexOpti, an embedded form or `POST /v1/clients`. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.client.created",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "client.created"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "client_id"
                    ],
                    "properties": {
                      "client_id": {
                        "type": "string"
                      },
                      "case_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "client.updated": {
      "post": {
        "summary": "client.updated",
        "description": "A client's identity or its ongoing vigilance changed: `changed_fields` lists the public fields that changed (`person.last_name,address.city`, `monitoring_enabled`…), comma separated and sorted, never their values. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.client.updated",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "client.updated"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "client_id",
                      "changed_fields"
                    ],
                    "properties": {
                      "client_id": {
                        "type": "string"
                      },
                      "changed_fields": {
                        "type": "string"
                      },
                      "case_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "client.vigilance_level_changed": {
      "post": {
        "summary": "client.vigilance_level_changed",
        "description": "The vigilance level a client's screening results give (`vigilance_level`) changed: after a check, a monitoring run or a member's review of a match. Read the client. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.client.vigilance_level_changed",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "client.vigilance_level_changed"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "client_id"
                    ],
                    "properties": {
                      "client_id": {
                        "type": "string"
                      },
                      "case_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "client.risk_level_changed": {
      "post": {
        "summary": "client.risk_level_changed",
        "description": "A member validated a different risk level for a client. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.client.risk_level_changed",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "client.risk_level_changed"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "client_id"
                    ],
                    "properties": {
                      "client_id": {
                        "type": "string"
                      },
                      "case_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "client.preliminary_screening_completed": {
      "post": {
        "summary": "client.preliminary_screening_completed",
        "description": "A free preliminary screening of a client against the official freeze and sanctions lists (French register, EU, OFAC) ended with a result: `status` (`completed`, `failed`), `outcome` (`no_match`, `possible_match`) when completed, `trigger` (`initial`: your application created the client through the API; `identity_change`: your application changed a screened identity field of such a client; `requested`: your application asked for the screening; `list_update`: a new publication of the lists changed its result). A search the lists could not answer yet (`unavailable`) sends nothing: LexOpti retries it and tells the result. Read `GET /v1/clients/{id}/preliminary-screening`. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.client.preliminary_screening_completed",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "client.preliminary_screening_completed"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "client_id",
                      "status",
                      "trigger"
                    ],
                    "properties": {
                      "client_id": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "completed",
                          "failed"
                        ]
                      },
                      "trigger": {
                        "type": "string",
                        "enum": [
                          "initial",
                          "identity_change",
                          "list_update",
                          "requested"
                        ]
                      },
                      "outcome": {
                        "type": "string",
                        "enum": [
                          "no_match",
                          "possible_match"
                        ]
                      },
                      "case_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "classification.validated": {
      "post": {
        "summary": "classification.validated",
        "description": "A member validated a classification: a client's own (`subject: client`, `client_id`) or a case's (`subject: case`, `case_id`). Once per validation, even when the level did not change. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.classification.validated",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "classification.validated"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "subject"
                    ],
                    "properties": {
                      "subject": {
                        "type": "string",
                        "enum": [
                          "client",
                          "case"
                        ]
                      },
                      "client_id": {
                        "type": "string"
                      },
                      "case_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "case.created": {
      "post": {
        "summary": "case.created",
        "description": "A member created a case, with its main client (`client_id`) when it has one. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.case.created",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "case.created"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "case_id"
                    ],
                    "properties": {
                      "case_id": {
                        "type": "string"
                      },
                      "client_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "case.updated": {
      "post": {
        "summary": "case.updated",
        "description": "A case's label, clients, parties or assignees changed: `changed_fields` names which (`label`, `clients`, `parties`, `assignees`), comma separated and sorted. Assignees are not exposed: read the case for the rest. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.case.updated",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "case.updated"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "case_id",
                      "changed_fields"
                    ],
                    "properties": {
                      "case_id": {
                        "type": "string"
                      },
                      "changed_fields": {
                        "type": "string"
                      },
                      "client_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "case.risk_level_changed": {
      "post": {
        "summary": "case.risk_level_changed",
        "description": "A member validated a different risk level for a case. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.case.risk_level_changed",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "case.risk_level_changed"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "case_id"
                    ],
                    "properties": {
                      "case_id": {
                        "type": "string"
                      },
                      "client_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "report.generated": {
      "post": {
        "summary": "report.generated",
        "description": "A member generated a new version of a case's report whose content, the suspicion axis left out, changed: `GET /v1/cases/{id}/report` serves it. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.report.generated",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "report.generated"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "case_id"
                    ],
                    "properties": {
                      "case_id": {
                        "type": "string"
                      },
                      "client_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "alert.created": {
      "post": {
        "summary": "alert.created",
        "description": "A source changed about a monitored client or one of its parties. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.alert.created",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "alert.created"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "alert_id",
                      "client_id"
                    ],
                    "properties": {
                      "alert_id": {
                        "type": "string"
                      },
                      "client_id": {
                        "type": "string"
                      },
                      "case_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "alert.resolved": {
      "post": {
        "summary": "alert.resolved",
        "description": "A member reviewed an alert. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.alert.resolved",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "alert.resolved"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "alert_id",
                      "client_id"
                    ],
                    "properties": {
                      "alert_id": {
                        "type": "string"
                      },
                      "client_id": {
                        "type": "string"
                      },
                      "case_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "decision.pending": {
      "post": {
        "summary": "decision.pending",
        "description": "Something awaits a member's decision: a level review after a monitoring change (`kind: level_review`) or an assistant's proposed review of an alert (`kind: alert_review_proposal`, with `alert_id`). Only a member decides, in LexOpti or its embedded screens. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.decision.pending",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "decision.pending"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "kind",
                      "decision_id",
                      "client_id"
                    ],
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "level_review",
                          "alert_review_proposal"
                        ]
                      },
                      "decision_id": {
                        "type": "string"
                      },
                      "client_id": {
                        "type": "string"
                      },
                      "case_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "quota.exhausted": {
      "post": {
        "summary": "quota.exhausted",
        "description": "The organization spent its last credit: a check that opens or grows a case is refused (`quota_exceeded`) until it moves up an offer or buys a recharge; launches within a case's paid year and for the people already counted stay free. Read `GET /v1/usage`. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.quota.exhausted",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "quota.exhausted"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [],
                    "properties": {
                      "client_id": {
                        "type": "string"
                      },
                      "case_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "subscription.inactive": {
      "post": {
        "summary": "subscription.inactive",
        "description": "The organization stopped being a client (`reason`, its subscription's status): no offer runs, its credits are frozen, its vigilance pauses and checks are refused (`subscription_inactive`) until it subscribes again. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.subscription.inactive",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "subscription.inactive"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "reason"
                    ],
                    "properties": {
                      "reason": {
                        "type": "string",
                        "enum": [
                          "trial_ended",
                          "expired",
                          "past_due",
                          "canceled",
                          "incomplete"
                        ]
                      },
                      "client_id": {
                        "type": "string"
                      },
                      "case_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "access.revoked": {
      "post": {
        "summary": "access.revoked",
        "description": "Your application lost its access to the organization (`reason`): the last delivery to the endpoint, which is then disabled (`disabled_reason: access_revoked`). Sent to every endpoint of the application in the organization, whatever its event types; never in `GET /v1/events`. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.access.revoked",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "access.revoked"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "reason"
                    ],
                    "properties": {
                      "reason": {
                        "type": "string",
                        "enum": [
                          "consent_revoked",
                          "blocked",
                          "application_disabled"
                        ]
                      },
                      "client_id": {
                        "type": "string"
                      },
                      "case_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "member.enrolled": {
      "post": {
        "summary": "member.enrolled",
        "description": "An owner or admin enrolled a person of the organization through your application (`POST /v1/members/enrolments`): `status` is `pending` until their first e-mail code, or `activated` at once in delegated mode ([glossary](https://developers.lexopti.com/glossary/)) (then with `member_id`). Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.member.enrolled",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "member.enrolled"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "enrolment_id",
                      "role",
                      "status",
                      "member_id"
                    ],
                    "properties": {
                      "enrolment_id": {
                        "type": "string"
                      },
                      "role": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "completed",
                          "failed"
                        ]
                      },
                      "member_id": {
                        "type": "string"
                      },
                      "client_id": {
                        "type": "string"
                      },
                      "case_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    },
    "member.joined": {
      "post": {
        "summary": "member.joined",
        "description": "An enrolled person became a member of the organization: at their first e-mail code, or at once in delegated mode ([glossary](https://developers.lexopti.com/glossary/)). `member_id` is their user id, the `id` of `GET /v1/members`; `role` their role. Signed as Standard Webhooks: verify `webhook-signature` with the endpoint secret, deduplicate on `webhook-id`.",
        "operationId": "webhook.member.joined",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "timestamp",
                  "livemode",
                  "data"
                ],
                "properties": {
                  "type": {
                    "const": "member.joined"
                  },
                  "livemode": {
                    "type": "boolean",
                    "description": "False for an event of a sandbox organization: fixture data, never a real screening."
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "data": {
                    "type": "object",
                    "required": [
                      "enrolment_id",
                      "member_id",
                      "role"
                    ],
                    "properties": {
                      "enrolment_id": {
                        "type": "string"
                      },
                      "member_id": {
                        "type": "string"
                      },
                      "role": {
                        "type": "string"
                      },
                      "client_id": {
                        "type": "string"
                      },
                      "case_id": {
                        "type": "string"
                      },
                      "client_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the client, when it set one."
                      },
                      "case_external_ref": {
                        "type": "string",
                        "description": "Your application's reference of the case, when the event concerns a case and it set one."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges the delivery; anything else is retried."
          }
        }
      }
    }
  }
}
