PUBLISHING API / V1
Publish docs
with every release.
Create an API once, then send an updated document after each successful deployment. APIRecap makes the new version current and keeps earlier documents for your team. Owners and Editors can delete versions. The Owner controls external access to version history.
First publish? Start with the project and key setup below, then run the create request. Return here for the version-upload command after your next deployment.
Before you start
Create a project in APIRecap and note its numeric ID from the project URL, for example /projects/1. Then create a named publishing key in Settings → API keys. Copy it when shown: the full key cannot be retrieved later.
Authorization: Bearer header. Owners and Editors can publish to projects they can edit; Readers cannot publish.In the commands below, replace project 1, the API slug payments, and the local file path with your values. Set APIRECAP_API_KEY in your shell or CI secret store. Set APIRECAP_URL to https://apirecap.com for the hosted service, or your own instance's base address without a trailing slash. A localhost address works only on your own machine.
Create an API from a document
Use POST /api/v1/projects/{project}/apis to create a new API inside an existing project. The request needs a name and a document. A slug is optional; if omitted, APIRecap suggests one from the name.
curl -fS -X POST "$APIRECAP_URL/api/v1/projects/1/apis" \
-H "Authorization: Bearer $APIRECAP_API_KEY" \
-F "name=Payments" \
-F "slug=payments" \
-F "document=@openapi.yaml"A successful create returns 201 Created with the API ID, project ID, slug, format, visibility, and "version": 1. Use the slug for later updates. The example shows an Owner's key: new APIs default to listed for Owners and private for Editors.
{"id":7,"project_id":1,"name":"Payments","slug":"payments","version":1,"format":"openapi_yaml","visibility":"listed"}For a JSON request, send an OpenAPI object in document with Content-Type: application/json. For Markdown or YAML text in JSON, set format to markdown or openapi_yaml and pass the source text in document.
Publish the next version
After a successful production deployment, send the replacement file to POST /api/v1/projects/{project}/apis/{api-slug}/versions. Each accepted request stores a new version and makes it the latest. Its content stays unchanged unless you delete that version.
curl -fS -X POST "$APIRECAP_URL/api/v1/projects/1/apis/payments/versions" \
-H "Authorization: Bearer $APIRECAP_API_KEY" \
-F "document=@openapi.yaml"The response returns the new version number. Your current docs link points to it; retained versions keep their own URLs. External access to older versions depends on the Owner's sharing settings. Source comparisons show adjacent retained versions. Release facts compare the new document with the version that was current before publishing. If your workflow sends a JSON body instead of a file, PUT /api/v1/projects/{project}/apis/{api-slug} also publishes the next version.
For API publishes, APIRecap tries to draft a private release note from the detected changes. If a suggestion is unavailable, you can write the note yourself. An Owner or Editor checks and approves it before readers see the note. Subscribers receive a release alert after that first approval.
{"id":7,"project_id":1,"name":"Payments","slug":"payments","version":2,"format":"openapi_yaml"}Formats and limits
.json file or JSON object.yaml or .yml file, or YAML text.md file or UTF-8 textOpenAPI 3.0 and 3.1 documents are validated before storage. Documents have a 2 MB limit. The first document fixes that API's format: later versions must use the same type. To change from YAML to JSON or Markdown, create another API.
Invalid requests do not publish a version. Use the response to check what needs to change:
| Status | What to do |
|---|---|
| 401 · Invalid key | Check the bearer key. Replace it if revoked, or if its account no longer has publishing access. |
| 403 · Forbidden action | Check the key owner's permissions. Only the workspace Owner can change external visibility. |
| 404 · Not found | Check the project ID and API slug. Projects outside the key's access are also unavailable. |
| 413 · Request too large | Reduce the JSON request to 2 MB or less. Oversized uploaded files can instead return 422. |
| 415 · Unsupported request | Send a JSON body or a multipart file upload using the examples above. |
| 422 · Validation failed | Read the field errors. Check the document, file size, slug and API format before retrying. |