Gravity is now available.

See pricing
Gravity

Reference docs, generated from your code.

Gravity reads your OpenAPI file and your code, writes the reference, and ties every fact to the code it came from. When the code changes, the docs change with it.

src/keys.go

12// Keys
13const graceWindow = 24 * time.Hour
14
15r.POST("/v1/keys/rotate", rotateKey)
16
17func rotateKey(w, r) {
18 id := body.String("keyId")
19 idem := r.Header.Get("X-Idempotency-Key")
20 …
21}
22
23type RotateResponse struct {
24 Key string
25 ExpiresAt time.Time
26}

API reference Keys

Parameters

Response

Writing from src/keys.go…

Generated doesn’t mean unreviewed

Every generated update arrives as a change request in the same review queue as hand-written edits. Nothing reaches your readers until someone on your team approves it.

Your pipeline tells you the docs are wrong, before your customers do.

When a code change outpaces the reference, Gravity doesn’t wait for someone to notice. It proposes the matching update, as a change you can read in seconds.

  • One step in the pipeline you already haveThe check runs on every pull request. No annotations or sidecar files to maintain.
  • New, changed and removed endpointsIt notices what moved in the code and which pages describe it.
  • The exact edit, ready to reviewThe update arrives as a change request, so the reference is corrected before it ships.

Try a pull request that

Make key rotation safe to retry

#1287

src/gateway.go

−r.POST("/v1/keys/rotate", rotateKey)

+r.POST("/v1/keys/rotate", idempotent(rotateKey))

Docs drift check

running
  • Comparing the gateway with the published reference
Waiting for the check to finish

A reference your team trusts on sight.

Every endpoint, parameter and type, organised by service and ready to publish on your own domain.

  • A map of your whole codebaseServices, packages and module boundaries are laid out for you, so a new engineer can find their way on day one.
  • Typed, end to endEndpoints, methods, parameters and types come from your OpenAPI or Swagger file, and change when it does.

Pick an endpoint, and open a type to see its fields.

Keys

Rotate an API key

Issues a new key. The previous key stays valid for 24 hours.

POSThttps://api.acme.com/v1/keys/rotate

  • keystring

    The new API key. Shown once.

  • expiresAttimestamp

    When the previous key stops working.

  • The key being replaced.

Generated from src/gateway.go, line 41In step with main · updated by change request #418

You own the words. Gravity keeps the facts.

Generated blocks stay tied to the code they describe, and everything around them is yours to write. Editing a generated block opens a suggestion for the code’s owner; it never overwrites anything silently.

Written by youOwned by the docs team · edit it freely

Rotating an API key

Keep your integrations secure by rotating keys on a schedule.

Your words around a bound factYour sentence · “24 hours” comes from src/keys.go, line 18

Call the rotate endpoint to issue a new key. The old key stays valid for so you can roll it out without downtime.

Generated from sourceBound to src/keys.go, line 19 · owned by @keys-team

POST /v1/keys/rotate → { key: string, expiresAt: timestamp }

Written by youOwned by the docs team · edit it freely

In production, keep the returned key in your secret manager, not in source control.

Source code · owned by @keys-team

src/keys.go

18const graceWindow = 24 * time.Hour
19func rotateKey(w, r) {
20 …

Edited a generated block?

Your edit becomes a suggestion for the code’s owner, so the docs and the code never disagree.

The difference your readers feel.

The same endpoint, kept two ways. One drifts as soon as an engineer ships a change; the other moves with the code.

Jan · Page written

Kept by hand

Edited today

POST /v1/keys/rotate

  • Body: keyId (string)
  • The old key stays valid for 1 hour
  • Retrying a request issues another new key
  • Returns key (string)

Correct, for now.

Kept by Gravity

In step with main

POST /v1/keys/rotate

  • Body: keyId (string)
  • The old key stays valid for 1 hour
  • Retrying a request issues another new key
  • Returns key (string)

Generated from the code, and tied to it.

See it on your own code.

Connect a repository and see your reference generated, then kept in step with every change.