zenly/Documentação
Buscar na documentação
Português
API referenceGetting started

OpenAPI

The API describes itself. Every endpoint, field and type on this surface is in one OpenAPI 3.1 document, which is the thing to generate a client from rather than writing request code by hand.

Where to get it

All three answer without a key, so you can read the whole contract and generate a client before you have a credential to call it with.

/v1/openapi.jsonOpen

The document as JSON. This is the one generators want.

/v1/openapi.yamlOpen

The same document as YAML, for tools that prefer it and for reading by eye.

/v1/schemas/<Name>.json

Each type as a standalone JSON Schema, which is what the $schema field in a response points at.

Generating a client

Any OpenAPI 3.1 generator works. Point it at the JSON document and let it produce the types and the request code:

Terminal
# TypeScript types
npx openapi-typescript https://api.zenly.app.br/v1/openapi.json -o zenly.d.ts

# Go client
oapi-codegen -package zenly https://api.zenly.app.br/v1/openapi.json > zenly.go

Generating beats hand-writing request code for the same reason the document exists: when a field is added, you regenerate instead of reading a changelog.

Validating a response

Every response body carries a $schema field, and every response carries the same URL in a Link header with rel="describedBy". Either one tells you which schema the body should validate against, so a strict client can check a payload without hardcoding the mapping.

HTTP
Link: <https://api.zenly.app.br/v1/schemas/OrganizationBody.json>; rel="describedBy"

If you are not validating, ignore both. $schema is safe to drop on the floor.

When the document changes

Fields and endpoints get added under /v1; nothing already there is removed or repurposed. So regenerating a client is safe, and a generator configured to reject unknown fields is the one thing that will break on an additive change. Configure it to ignore them.