Skip to main content

Spec

2 operations (GET): parameters, status codes, refusal bodies, and the same request in curl, HTTP, Python and TypeScript.

1 min read
View MarkdownEdit on GitHub

Base URL: https://api.codespar.dev

None of the operations below takes a credential: the published document declares them open. See Authentication for the rest of the API.

GET /openapi.json

GEThttps://api.codespar.dev/openapi.json
No credential

This document

Built once per boot from static Zod definitions, identical for every caller, and served with no credential — which is the whole point of ent#964. /v1/openapi.json returns the same bytes.

Responses

StatusBodyDescription
200objectOK
Example request
curl -X GET https://api.codespar.dev/openapi.json \
  -H "Authorization: Bearer $CODESPAR_API_KEY"
GET /openapi.json HTTP/1.1
Host: api.codespar.dev
Authorization: Bearer $CODESPAR_API_KEY
import os
import requests

res = requests.get(
    "https://api.codespar.dev/openapi.json",
    headers={"Authorization": f"Bearer {os.environ['CODESPAR_API_KEY']}"},
)
res.raise_for_status()
data = res.json()
const res = await fetch("https://api.codespar.dev/openapi.json", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
  },
});

const data = await res.json();
const result = await cs.api.get("/openapi.json");

GET /v1/openapi.json

GEThttps://api.codespar.dev/v1/openapi.json
No credential

This document, under the /v1 mount

Identical to /openapi.json. Both mounts exist because a generator, a crawler or a reader will try either.

Responses

StatusBodyDescription
200objectOK
Example request
curl -X GET https://api.codespar.dev/v1/openapi.json \
  -H "Authorization: Bearer $CODESPAR_API_KEY"
GET /v1/openapi.json HTTP/1.1
Host: api.codespar.dev
Authorization: Bearer $CODESPAR_API_KEY
import os
import requests

res = requests.get(
    "https://api.codespar.dev/v1/openapi.json",
    headers={"Authorization": f"Bearer {os.environ['CODESPAR_API_KEY']}"},
)
res.raise_for_status()
data = res.json()
const res = await fetch("https://api.codespar.dev/v1/openapi.json", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
  },
});

const data = await res.json();
const result = await cs.api.get("/v1/openapi.json");
Spec | CodeSpar