Skip to main content

Swagger / OpenAPI

Kvery can publish interactive API documentation for a group's shared queries. Each published query becomes a documented endpoint in a Swagger UI page, so consumers can explore and try your endpoints without you hand-writing API docs.

What you get​

  • A Swagger UI page describing the group's published endpoints.
  • An underlying OpenAPI definition that other tools can import.
  • A shareable link, addressed by a hash, that you can hand to API consumers.

Which queries are included​

Swagger is configured per group. Kvery builds the documentation from the queries that are published there — their paths, the HTTP methods they answer, and the parameters they accept (derived from your form variables). A query is included when it is shared, its share link has not expired and it carries the swagger tag (in any letter case). The documentation describes the published version of each query: an unpublished draft doesn't change it until you publish it.

Swagger settings​

Editors of the group open the settings with the Swagger button at the top of the Queries list; other members don't see the button. The Swagger settings window reminds you: "Use "swagger" tag to appear in Swagger! *It works with shared queries only!", and its Open Swagger URL link opens the Swagger page of the group (its address is created the first time the window is opened).

SettingWhat it does
TitleThe title of the documentation (default: "Kvery - Swagger")
VersionThe version shown in the documentation (default: 1.0.0)
AuthorizationHow the documentation tells callers to authenticate: None, Bearer or ApiKey
KeyWith ApiKey: the name of the key (default: X-API-KEY)
LocationWith ApiKey: where the key is sent, Header or Query

Save stores them ("Swagger settings updated!").

The authorization settings describe the authentication in the document, so that Swagger UI asks for it and sends it; Kvery does not check the key itself. Check it in the SQL of the queries: a bearer token reaches a query as $token (with Bearer this variable is not listed as a parameter), and a key sent in the query string fills the form variable of its name. A key sent in a header fills the form variable of its name only when the name is a valid variable name (letters, digits and _; X-API-KEY is not, see Request headers as values). See Securing the endpoint.

How a query is documented​

  • Path — /query/api/{hash} of the query. The $variables of a custom URL become required path parameters (users/$id is documented as users/{id}).
  • Method — the method chosen in front of the custom URL. With All, a query without form fields (besides its path variables and, with Bearer, $token) is documented as GET, and a query with form fields — Label and Link fields included — as POST.
  • Parameters — the input fields of the form (Label and Link fields are left out): a JSON request body for POST, PUT and PATCH, query-string parameters otherwise. A field marked Required? is required, and its Swagger Description is its description. The field type gives the type: Input number a number, Checkbox a list, Select and Radio their option values (two options true / false a boolean), Date a date, Input e-mail an e-mail address, Input URL a URI, Input color a colour. A field of another type whose default value is a JSON object or array is documented as an object.
  • Summary and tags — the description of the query, and its own tags (without swagger), each written with a capital first letter and the rest in lower case.
  • Responses — 200; each ON ERROR RETURN '…' message of the SQL with the status of its SET HTTPCODE (500 without one); 400 with the "Missing parameters" message when the query has required fields; 429 when the query has a rate limit, whose values are added to the summary ("max … req. / … sec.").

Accessing it​

The documentation is served at a Swagger view URL identified by a hash, and its OpenAPI document at the matching data URL:

https://app.kvery.io/swagger/{hash}
https://app.kvery.io/swagger/data/{hash}

Consumers open the first link to read the docs and try requests interactively; tools can import the definition from the second. The page lists the tags and the endpoints in alphabetical order. An unknown hash answers 404 on the page and an empty JSON array ([]) on the data URL. The page can also be shown in a frame (<iframe>) on a page of another site. Both are sent with Cache-Control: private, no-store, so no browser or proxy cache keeps them. When the group has an IP whitelist, both answer only allowed addresses (and members who have the group open in Kvery).

Tips​

  • Give your queries clear names and descriptions — they surface in the generated docs. The AI assistant can draft descriptions for you.
  • Keep parameter names meaningful; they become the documented request parameters.
  • Combine Swagger with API security so the documented endpoints stay protected.