Skip to main content

Discovery

1 operation under /v1/discovery/manifest (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

Every operation below requires a Bearer token. See Authentication.

GET /v1/discovery/manifest

GEThttps://api.codespar.dev/v1/discovery/manifest

The project's x402 discovery manifest

The caller's own x402 manifest: the machine-readable index of what a crawler or an agent can pay for, in the same shape the public gateway serves it, so a dashboard can preview the real thing rather than a reconstruction.

The content is the project's ACTIVE paywalls in the environment the credential authenticates in, oldest first. Nothing here is a secret: the same manifest is served unauthenticated at the gateway, because every field in it is already exposed by the paywall URLs it indexes. A project with no active paywalls answers with an empty resources array, which is a well-formed manifest and not an error.

The prices mirror the live challenge, including the current tier for a tiered paywall — so what a crawler reads here is what it would be quoted by calling the URL.

Requires the servers:read scope.

Responses

StatusBodyDescription
200objectOK

Response 200

FieldTypeRequiredDescription
environment"live" | "test"yesEcho of the environment. It selects the paywalls AND the network and token in every accepts entry, so one manifest never mixes the two.
manifestobjectyes—
project_idstringyesEcho of the project the credential resolved to.
Example request
curl -X GET https://api.codespar.dev/v1/discovery/manifest \
  -H "Authorization: Bearer $CODESPAR_API_KEY"
GET /v1/discovery/manifest HTTP/1.1
Host: api.codespar.dev
Authorization: Bearer $CODESPAR_API_KEY
import os
import requests

res = requests.get(
    "https://api.codespar.dev/v1/discovery/manifest",
    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/discovery/manifest", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.CODESPAR_API_KEY}`,
  },
});

const data = await res.json();
const result = await cs.api.get("/v1/discovery/manifest");
Example response 200
application/json
{
  "manifest": {
    "x402Version": 2,
    "resources": [
      {
        "url": "https://example.com/hook",
        "description": "string",
        "pricing_model": "flat",
        "variable_price": true,
        "accepts": [
          {
            "scheme": "exact",
            "network": "string",
            "asset": "string",
            "amount": "1000",
            "payTo": "string",
            "maxTimeoutSeconds": 1,
            "extra": {
              "name": "Example",
              "version": "string"
            }
          }
        ]
      }
    ],
    "gateway_unavailable_reason": "gateway_origin_not_configured"
  },
  "project_id": "prj_0000000000000000",
  "environment": "live"
}
Discovery | CodeSpar