There is a tool provided by pydantic for this: https://docs.pydantic.dev/latest/integrations/datamodel_code_generator/ Here is the OpenAPI spec for the public v2 API: https://mongodb-mms-prod-build-server.s3.amazonaws.com/openapi/2caffd88277a4e27c95dcefc7e3b6a63a3b03297-v2-2023-11-15.json