API Catalog (RFC 9727) Builder
Builds an application/linkset+json response that conforms to RFC 9727. Add APIs with anchor URLs and link relations like service-desc, service-doc, status, and item.
https://example.com/api/v1
api-catalog (linkset+json)
json · 25 lines · 503 B
{
"linkset": [
{
"anchor": "https://example.com/api/v1",
"service-doc": [
{
"href": "https://example.com/docs/api/v1",
"type": "text/html"
}
],
"service-desc": [
{
"href": "https://example.com/api/v1/openapi.json",
"type": "application/json"
}
],
"status": [
{
"href": "https://status.example.com"
}
],
"description": "Public REST API v1."
}
]
}Next.js route handler
typescript · 38 lines · 816 B
// app/.well-known/api-catalog/route.ts
import { NextResponse } from "next/server";
const PAYLOAD = {
"linkset": [
{
"anchor": "https://example.com/api/v1",
"service-doc": [
{
"href": "https://example.com/docs/api/v1",
"type": "text/html"
}
],
"service-desc": [
{
"href": "https://example.com/api/v1/openapi.json",
"type": "application/json"
}
],
"status": [
{
"href": "https://status.example.com"
}
],
"description": "Public REST API v1."
}
]
};
export async function GET() {
return NextResponse.json(PAYLOAD, {
headers: {
"content-type": "application/linkset+json; charset=utf-8",
"cache-control": "public, max-age=300",
},
});
}
Apply this with your coding agent
Get a ready-made prompt that wraps the output above with implementation steps. Paste it into your AI assistant and let it ship the change.
Validate with
About RFC 9727
RFC 9727 defines a well-known URI /.well-known/api-catalog that returns a Linkset document describing a publisher's APIs. Agents and tooling can fetch this single resource to discover every API instead of scraping HTML.
The response must use the application/linkset+json content type. Use the Link Headers Builder to advertise this from your homepage.
Verify on a real URL
Run a full agent readiness scan to see how your live site responds end to end.