WriftAI's API now has a public OpenAPI spec
Jul 30, 2024
2 minute read
The WriftAI API now has a public OpenAPI 3.1 specification at api.wrift.ai/v1/openapi.json. Every endpoint, request body, response shape, and auth requirement is machine-readable. The spec stays in sync as the API grows.
Import it into your HTTP client
Postman and Insomnia both support importing an OpenAPI spec from a URL. You get every endpoint pre-configured: correct content types, field names, and request schemas. No setup beyond pasting the URL.
Browse it as documentation
Redoc renders the spec into browsable docs locally:
1npx @redocly/cli@1.18.1 preview-docs https://api.wrift.ai/v1/openapi.json
Opens at http://localhost:8080. Every field shows its type, whether it is required, and the accepted values.
Run a mock server
Prism reads the spec and starts a local server that returns schema-accurate responses for every endpoint:
1npx @stoplight/prism-cli@4.10.1 mock https://api.wrift.ai/v1/openapi.json
Running at http://localhost:4010. No token needed. The responses are generated from the schema, not real inference, but the shapes are accurate. Build and test your integration against it without making real API calls.
Generate a client
OpenAPI Generator produces a typed client from the spec. It requires Java at runtime:
1npx @openapitools/openapi-generator-cli@2.13.4 generate \2 -i https://api.wrift.ai/v1/openapi.json \3 -g python \4 -o ./wriftai-client
Method names are derived from the spec's operation IDs. The generated code includes request serialization and auth header scaffolding. You configure the token, it handles the rest. Over 50 other languages and frameworks are supported.
What's Ahead
We are building official clients for Python, JavaScript, Go, and a CLI. Until they ship, the generated clients are a working option. The spec is stable. Field names and response shapes will not change without a version increment.