# Latitude 10 Registry API (1.0.0)

The API a Latitude 10 project's CI calls: push a version of the project's OpenAPI document and read its readiness report and breaking-change diff, get rules-only fixes as JSON Patch, push the project's docs, and generate its TypeScript and Python SDKs.
Every request carries a project key, `Authorization: Bearer l10p_…`, created on the project page under CI keys. The key names the project, so no workspace or project appears in a URL. Quotas are per plan; a request over one answers 429 with `resetsAt`, and retrying before then won't help.

Base URL: https://latitude10.tech/api/registry/v1

## Authentication
- projectKey: http, bearer. A project key (l10p_…) from the project page's CI keys. It names the project and can push to it, so keep it in your CI's secrets.

## Versions

The project's OpenAPI document, one version per push.

### GET /versions

List the project's versions

Lists every version of the project's OpenAPI document that the plan keeps, newest first, each with its readiness score and diff counts. The list isn't paginated; a plan keeps at most a few hundred versions.

Responses:
- 200: The versions, newest first.
- 401: No project key was sent, or it was revoked.
- 503: The registry is unavailable right now. Try again later.

### POST /versions

Push a version of the OpenAPI document

Pushes the project's OpenAPI document (3.0 or 3.1, YAML or JSON, bundled into one file) as the request body. The registry scores it with the readiness rules and diffs it against the latest version. Answers 201 with the new version, or 200 with the latest version when the bytes are the same as the latest's, so pushing the same document twice keeps one version. Every push counts toward the daily push quota, the repeated one too.

Parameters:
- `label` (query, string): A label shown beside the version, such as a short commit SHA or a release tag. Longer than 100 characters, it is cut to 100. Without one, the document's info.version is the label.
- `git_sha` (query, string): The Git commit the document was pushed from.
- `git_ref` (query, string): The Git ref the document was pushed from.

Request body: application/json, required. The OpenAPI document, as YAML or JSON text, up to the plan's document size.

Responses:
- 200: The document is the same as the latest version's; that version is answered and no new one is made.
- 201: The new version.
- 401: No project key was sent, or it was revoked.
- 403: The project is read-only, because the workspace has more projects than its plan includes.
- 409: Another version was pushed at the same moment. Push again.
- 413: The document is larger than the plan keeps.
- 422: The body isn't an OpenAPI 3.0 or 3.1 document, or it has an external $ref.
- 429: A quota of the plan is reached for this period. Wait until resetsAt; retrying sooner answers the same.
- 503: The registry is unavailable right now. Try again later.

### GET /versions/latest

Get the latest version

Answers the newest version of the project's document with its readiness score, its finding count and its breaking-change counts against the version before it. Answers 404 when nothing has been pushed yet.

Responses:
- 200: The latest version.
- 401: No project key was sent, or it was revoked.
- 404: This project has no versions yet.
- 503: The registry is unavailable right now. Try again later.

### GET /versions/{seq}/report

Get a version's readiness report

Answers the readiness report stored when the version was pushed, with the score, the rules version, and every rule with its findings and suggested fix. Use it to show why a version scored what it did.

Parameters:
- `seq` (path, required, string): The version's number, as listed by listVersions.

Responses:
- 200: The stored report.
- 400: seq isn't a version number.
- 401: No project key was sent, or it was revoked.
- 404: There is no version with that number.
- 503: The registry is unavailable right now. Try again later.

### GET /versions/{seq}/source

Download a version's document as pushed

Answers the version's OpenAPI document byte for byte as it was pushed, as application/json when it was pushed as JSON and application/yaml otherwise. Use it to restore or compare a version.

Parameters:
- `seq` (path, required, string): The version's number, as listed by listVersions.

Responses:
- 200: The document as pushed.
- 400: seq isn't a version number.
- 401: No project key was sent, or it was revoked.
- 404: There is no version with that number.
- 503: The registry is unavailable right now. Try again later.

### GET /diff

Compare two versions

Lists what changed between any two versions of the project's document, each change marked breaking, warning or info. The diff stored on push answers when the pair is a version and the one before it; any other pair is computed on request.

Parameters:
- `from` (query, required, string): The older version's number.
- `to` (query, required, string): The newer version's number.

Responses:
- 200: The changes from one version to the other.
- 400: from or to is missing or isn't a version number.
- 401: No project key was sent, or it was revoked.
- 404: There is no version with that number.
- 503: The registry is unavailable right now. Try again later.

## Fixes

Rules-only fixes for a document, as JSON Patch.

### POST /fixes

Get rules-only fixes for a document

Scores the OpenAPI document in the body with the readiness rules and answers the fixes that raise its score, as a JSON Patch to apply to the document, with the score before and after. The fixes come from the rules alone; no model is called, so the same document always gets the same patch. Each call counts toward the workspace's monthly fix runs. Paid plans only.

Request body: application/json, required. The OpenAPI document, as YAML or JSON text.

Responses:
- 200: The fixes, as JSON Patch.
- 401: No project key was sent, or it was revoked.
- 403: Suggested fixes are part of the paid plans.
- 413: The document is larger than the plan reads.
- 422: The body isn't an OpenAPI 3.0 or 3.1 document, or it has an external $ref.
- 429: A quota of the plan is reached for this period. Wait until resetsAt; retrying sooner answers the same.
- 503: The registry is unavailable right now. Try again later.

## Docs

The project's hosted docs, pushed as a folder.

### POST /docs

Push the docs folder

Pushes the project's docs folder as a .tar.gz and builds the hosted docs from it. Without version or preview, the push replaces the production site, and only from the project's docs branch (the first branch pushed, until changed in the workspace). With version=<label> it becomes a versioned copy; with preview=1, a private preview of the branch that expires after 14 days. Counts toward the daily docs pushes.

Parameters:
- `branch` (query, required, string): The Git branch the docs were built from (letters, digits, ., _, / and -).
- `commit` (query, string): The Git commit SHA, 7 to 40 hex characters.
- `version` (query, string): Push as a versioned copy under this label (up to 20 lowercase letters, digits, dots and dashes). Not with preview.
- `preview` (query, string): Send 1 to push a private preview of the branch. Not with version. Any other value is ignored, and the push goes to production.

Request body: application/gzip, required. The docs folder as a .tar.gz, with its latitude10.docs.json and Markdown pages.

Responses:
- 201: The docs were built.
- 400: A query parameter is missing or malformed, or the body is empty.
- 401: No project key was sent, or it was revoked.
- 403: The project is read-only, or the plan has no room for another docs version or preview.
- 409: The branch isn't the project's docs branch. Push it with preview=1, or change the docs branch in the workspace.
- 413: The folder is larger, or has more pages, than the plan builds.
- 415: The body isn't a .tar.gz. Send Content-Type application/gzip.
- 422: The archive can't be read, or its latitude10.docs.json is invalid.
- 429: A quota of the plan is reached for this period. Wait until resetsAt; retrying sooner answers the same.
- 503: The registry is unavailable, or docs pushes on the Free plan are paused for now.

### DELETE /docs/previews/{branch}

Delete a branch's docs preview

Deletes the docs preview of a branch, for when its pull request closes. Answers 204 whether or not the branch had a preview, so it's safe to call on every closed pull request.

Parameters:
- `branch` (path, required, string): The branch, URL-encoded (feature%2Fsearch for feature/search).

Responses:
- 204: The branch has no preview now.
- 401: No project key was sent, or it was revoked.
- 503: The registry is unavailable right now. Try again later.

## SDK

TypeScript and Python SDKs generated from a version.

### POST /sdks/typescript

Generate the TypeScript SDK

Generates the project's TypeScript SDK from a registry version and the project's latitude10.sdk.json, sent as the body, and answers the npm package as a .tgz. The package version follows the registry diff (breaking changes bump the major). The same config and version answer the same build again. Counts toward the daily SDK generations. Pro and Business.

Parameters:
- `version` (query, string): The registry version to generate from, latest (the default) or a version number.

Request body: application/json, required. The project's latitude10.sdk.json, up to 16 KB.

Responses:
- 200: The generated package as a .tgz, with its GENERATION.md listing anything left out.
- 400: version isn't latest or a version number.
- 401: No project key was sent, or it was revoked.
- 402: SDKs come with Pro.
- 403: The document has more operations than the plan generates SDKs for. Use include or exclude in latitude10.sdk.json.
- 404: The project has no registry versions yet, or not the one asked for.
- 409: The registry version is older than the package's last build. Generate from that version or later.
- 413: latitude10.sdk.json is over 16 KB.
- 422: latitude10.sdk.json is invalid or has no section for this language, or the version can't be read or modelled.
- 429: A quota of the plan is reached for this period. Wait until resetsAt; retrying sooner answers the same.
- 503: The registry is unavailable right now. Try again later.

### GET /sdks/typescript/builds

List the TypeScript SDK builds

Lists the project's TypeScript SDK builds, newest first, with each one's package version, the registry version it was built from, and the changes that set its version bump.

Responses:
- 200: The builds, newest first.
- 401: No project key was sent, or it was revoked.
- 503: The registry is unavailable right now. Try again later.

### POST /sdks/python

Generate the Python SDK

Generates the project's Python SDK from a registry version and the python section of the project's latitude10.sdk.json, sent as the body, and answers the package's source as a .tgz to build and upload to PyPI. The same config and version answer the same build again. Counts toward the daily SDK generations. Pro and Business.

Parameters:
- `version` (query, string): The registry version to generate from, latest (the default) or a version number.

Request body: application/json, required. The project's latitude10.sdk.json, up to 16 KB.

Responses:
- 200: The generated package as a .tgz, with its GENERATION.md listing anything left out.
- 400: version isn't latest or a version number.
- 401: No project key was sent, or it was revoked.
- 402: SDKs come with Pro.
- 403: The document has more operations than the plan generates SDKs for. Use include or exclude in latitude10.sdk.json.
- 404: The project has no registry versions yet, or not the one asked for.
- 409: The registry version is older than the package's last build. Generate from that version or later.
- 413: latitude10.sdk.json is over 16 KB.
- 422: latitude10.sdk.json is invalid or has no section for this language, or the version can't be read or modelled.
- 429: A quota of the plan is reached for this period. Wait until resetsAt; retrying sooner answers the same.
- 503: The registry is unavailable right now. Try again later.

### GET /sdks/python/builds

List the Python SDK builds

Lists the project's Python SDK builds, newest first, with each one's package version, the registry version it was built from, and the changes behind each bump.

Responses:
- 200: The builds, newest first.
- 401: No project key was sent, or it was revoked.
- 503: The registry is unavailable right now. Try again later.
