{
  "openapi": "3.1.0",
  "info": {
    "title": "Chandan Kumar / SystemCraft Public API",
    "version": "1.4.0",
    "description": "Read-only public endpoints and agent discovery resources for chandankumar.dev. Use this API for status checks, discovery, and NeuroNZ catalogue search. Public endpoints advertise RateLimit headers and JSON error responses. Discovery documents are linked from llms.txt, /api/, /docs/, and /developers/."
  },
  "servers": [
    {
      "url": "https://chandankumar.dev/",
      "description": "Production website"
    }
  ],
  "tags": [
    {
      "name": "Discovery",
      "description": "Machine-readable discovery documents for agents and developers."
    },
    {
      "name": "Status",
      "description": "Read-only site status and resource discovery."
    },
    {
      "name": "NeuroNZ",
      "description": "Read-only Zotero-backed public catalogue search."
    }
  ],
  "paths": {
    "/wp-json/systemcraft/v1/status": {
      "get": {
        "tags": [
          "Status"
        ],
        "operationId": "getSystemcraftStatus",
        "summary": "Get public site and agent-resource status.",
        "description": "Returns a small JSON document identifying chandankumar.dev, its operational status, and links to machine-readable discovery resources. Use this before deeper crawling or API integration.",
        "responses": {
          "200": {
            "description": "Status response with links to discovery resources.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "product",
                    "status",
                    "resources"
                  ],
                  "properties": {
                    "product": {
                      "type": "string",
                      "description": "Public product/site name."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok"
                      ],
                      "description": "Operational status of the public read-only API surface."
                    },
                    "resources": {
                      "type": "object",
                      "required": [
                        "llms",
                        "openapi",
                        "openapiYaml",
                        "sitemap",
                        "developers",
                        "docs",
                        "status",
                        "neuronzSearch"
                      ],
                      "properties": {
                        "llms": {
                          "type": "string",
                          "format": "uri",
                          "description": "Canonical llms.txt instructions for agents."
                        },
                        "openapi": {
                          "type": "string",
                          "format": "uri",
                          "description": "Canonical OpenAPI JSON document."
                        },
                        "openapiYaml": {
                          "type": "string",
                          "format": "uri",
                          "description": "Canonical OpenAPI YAML document."
                        },
                        "sitemap": {
                          "type": "string",
                          "format": "uri",
                          "description": "WordPress sitemap index."
                        },
                        "developers": {
                          "type": "string",
                          "format": "uri",
                          "description": "Human and agent-readable developer resource page."
                        },
                        "docs": {
                          "type": "string",
                          "format": "uri",
                          "description": "API documentation page with examples and response shapes."
                        },
                        "status": {
                          "type": "string",
                          "format": "uri",
                          "description": "Status endpoint URL."
                        },
                        "neuronzSearch": {
                          "type": "string",
                          "format": "uri",
                          "description": "NeuroNZ catalogue search endpoint URL."
                        }
                      },
                      "additionalProperties": false
                    }
                  }
                },
                "examples": {
                  "ok": {
                    "value": {
                      "product": "Chandan Kumar / SystemCraft",
                      "status": "ok",
                      "resources": {
                        "llms": "https://chandankumar.dev/llms.txt",
                        "openapi": "https://chandankumar.dev/openapi.json",
                        "openapiYaml": "https://chandankumar.dev/api/openapi.yaml",
                        "sitemap": "https://chandankumar.dev/wp-sitemap.xml",
                        "developers": "https://chandankumar.dev/developers/",
                        "docs": "https://chandankumar.dev/docs/",
                        "status": "https://chandankumar.dev/wp-json/systemcraft/v1/status",
                        "neuronzSearch": "https://chandankumar.dev/wp-json/neuronz/v1/search"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/JsonError"
          },
          "404": {
            "$ref": "#/components/responses/JsonError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": []
      }
    },
    "/wp-json/neuronz/v1/search": {
      "get": {
        "tags": [
          "NeuroNZ"
        ],
        "operationId": "searchNeuroNzCatalogue",
        "summary": "Search the NeuroNZ Zotero-backed catalogue.",
        "description": "Searches public catalogue records fetched server-side from the NeuroNZ Zotero library. The Zotero API key is held server-side and is never required from clients. Results are paginated and include public metadata such as title, summary, source organisation, source URL, source category, data type, data period, IDI availability, and tags.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Case-insensitive free-text search across record ID, title, summary, organisation, category, data period, population coverage, and tags.",
            "schema": {
              "type": "string",
              "maxLength": 120
            },
            "example": "health"
          },
          {
            "name": "page",
            "in": "query",
            "description": "One-based result page number.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            },
            "example": 1
          },
          {
            "name": "max_per_page",
            "in": "query",
            "description": "Maximum results per page. Values above 50 are capped to 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            },
            "example": 20
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Alias for max_per_page for compatibility with agent and portal-style query strings.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            },
            "example": 20
          },
          {
            "name": "sortKey",
            "in": "query",
            "description": "Field used to sort results.",
            "schema": {
              "type": "string",
              "enum": [
                "title",
                "record_id",
                "source_category",
                "type_of_data",
                "available_in_idi",
                "data_period"
              ],
              "default": "title"
            },
            "example": "title"
          },
          {
            "name": "sortComparitor",
            "in": "query",
            "description": "Sort direction. The spelling matches the current public query parameter for compatibility.",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "asc"
            },
            "example": "asc"
          },
          {
            "name": "sourceCategory",
            "in": "query",
            "description": "Exact source category facet value returned by a previous response.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "typeOfData",
            "in": "query",
            "description": "Exact data-type facet value returned by a previous response.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "availableInIdi",
            "in": "query",
            "description": "Exact IDI availability facet value returned by a previous response.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated NeuroNZ catalogue search results.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "items",
                    "total",
                    "page",
                    "per_page",
                    "totalPages",
                    "facets"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "record_id",
                          "title",
                          "summary",
                          "primary_link",
                          "source_category",
                          "type_of_data",
                          "available_in_idi",
                          "zotero_tags"
                        ],
                        "properties": {
                          "record_id": {
                            "type": "string",
                            "description": "Stable NeuroNZ record ID parsed from Zotero extra metadata.",
                            "example": "NZNEURO-079"
                          },
                          "zotero_key": {
                            "type": "string"
                          },
                          "zotero_version": {
                            "type": "integer"
                          },
                          "title": {
                            "type": "string"
                          },
                          "summary": {
                            "type": "string"
                          },
                          "source_organisation": {
                            "type": "string"
                          },
                          "primary_link": {
                            "type": "string",
                            "format": "uri"
                          },
                          "language": {
                            "type": "string"
                          },
                          "source_category": {
                            "type": "string"
                          },
                          "type_of_data": {
                            "type": "string"
                          },
                          "age_group": {
                            "type": "string"
                          },
                          "data_period": {
                            "type": "string"
                          },
                          "design_type": {
                            "type": "string"
                          },
                          "population_coverage": {
                            "type": "string"
                          },
                          "approx_sample_size": {
                            "type": "string"
                          },
                          "available_in_idi": {
                            "type": "string"
                          },
                          "availability_access": {
                            "type": "string"
                          },
                          "all_source_links": {
                            "type": "string"
                          },
                          "zotero_tags": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "page": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "per_page": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 50
                    },
                    "totalPages": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "facets": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "sourceCategory",
                        "typeOfData",
                        "availableInIdi"
                      ],
                      "properties": {
                        "sourceCategory": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "typeOfData": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "availableInIdi": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/JsonError"
          },
          "404": {
            "$ref": "#/components/responses/JsonError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/JsonError"
          },
          "502": {
            "$ref": "#/components/responses/JsonError"
          }
        },
        "security": []
      }
    }
  },
  "components": {
    "headers": {
      "RateLimitLimit": {
        "description": "Maximum public API requests allowed per minute for this client.",
        "schema": {
          "type": "integer",
          "example": 120
        }
      },
      "RateLimitRemaining": {
        "description": "Approximate requests remaining in the current rate-limit window.",
        "schema": {
          "type": "integer",
          "example": 119
        }
      },
      "RateLimitReset": {
        "description": "Seconds until the current rate-limit window resets.",
        "schema": {
          "type": "integer",
          "example": 60
        }
      },
      "RetryAfter": {
        "description": "Seconds to wait before retrying after a 429 response.",
        "schema": {
          "type": "integer",
          "example": 60
        }
      }
    },
    "responses": {
      "JsonError": {
        "description": "Structured JSON error response with a machine-readable code and recovery hint.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "RateLimited": {
        "description": "The client should slow down and retry after the advertised delay.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          },
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    },
    "schemas": {
      "Status": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "product",
          "status",
          "resources"
        ],
        "properties": {
          "product": {
            "type": "string",
            "description": "Public product/site name."
          },
          "status": {
            "type": "string",
            "enum": [
              "ok"
            ],
            "description": "Operational status of the public read-only API surface."
          },
          "resources": {
            "type": "object",
            "required": [
              "llms",
              "openapi",
              "openapiYaml",
              "sitemap",
              "developers",
              "docs",
              "status",
              "neuronzSearch"
            ],
            "properties": {
              "llms": {
                "type": "string",
                "format": "uri",
                "description": "Canonical llms.txt instructions for agents."
              },
              "openapi": {
                "type": "string",
                "format": "uri",
                "description": "Canonical OpenAPI JSON document."
              },
              "openapiYaml": {
                "type": "string",
                "format": "uri",
                "description": "Canonical OpenAPI YAML document."
              },
              "sitemap": {
                "type": "string",
                "format": "uri",
                "description": "WordPress sitemap index."
              },
              "developers": {
                "type": "string",
                "format": "uri",
                "description": "Human and agent-readable developer resource page."
              },
              "docs": {
                "type": "string",
                "format": "uri",
                "description": "API documentation page with examples and response shapes."
              },
              "status": {
                "type": "string",
                "format": "uri",
                "description": "Status endpoint URL."
              },
              "neuronzSearch": {
                "type": "string",
                "format": "uri",
                "description": "NeuroNZ catalogue search endpoint URL."
              }
            },
            "additionalProperties": false
          }
        }
      },
      "ResourceLinks": {
        "type": "object",
        "required": [
          "llms",
          "openapi",
          "openapiYaml",
          "sitemap",
          "developers",
          "docs",
          "status",
          "neuronzSearch"
        ],
        "properties": {
          "llms": {
            "type": "string",
            "format": "uri",
            "description": "Canonical llms.txt instructions for agents."
          },
          "openapi": {
            "type": "string",
            "format": "uri",
            "description": "Canonical OpenAPI JSON document."
          },
          "openapiYaml": {
            "type": "string",
            "format": "uri",
            "description": "Canonical OpenAPI YAML document."
          },
          "sitemap": {
            "type": "string",
            "format": "uri",
            "description": "WordPress sitemap index."
          },
          "developers": {
            "type": "string",
            "format": "uri",
            "description": "Human and agent-readable developer resource page."
          },
          "docs": {
            "type": "string",
            "format": "uri",
            "description": "API documentation page with examples and response shapes."
          },
          "status": {
            "type": "string",
            "format": "uri",
            "description": "Status endpoint URL."
          },
          "neuronzSearch": {
            "type": "string",
            "format": "uri",
            "description": "NeuroNZ catalogue search endpoint URL."
          }
        },
        "additionalProperties": false
      },
      "SearchResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "items",
          "total",
          "page",
          "per_page",
          "totalPages",
          "facets"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "record_id",
                "title",
                "summary",
                "primary_link",
                "source_category",
                "type_of_data",
                "available_in_idi",
                "zotero_tags"
              ],
              "properties": {
                "record_id": {
                  "type": "string",
                  "description": "Stable NeuroNZ record ID parsed from Zotero extra metadata.",
                  "example": "NZNEURO-079"
                },
                "zotero_key": {
                  "type": "string"
                },
                "zotero_version": {
                  "type": "integer"
                },
                "title": {
                  "type": "string"
                },
                "summary": {
                  "type": "string"
                },
                "source_organisation": {
                  "type": "string"
                },
                "primary_link": {
                  "type": "string",
                  "format": "uri"
                },
                "language": {
                  "type": "string"
                },
                "source_category": {
                  "type": "string"
                },
                "type_of_data": {
                  "type": "string"
                },
                "age_group": {
                  "type": "string"
                },
                "data_period": {
                  "type": "string"
                },
                "design_type": {
                  "type": "string"
                },
                "population_coverage": {
                  "type": "string"
                },
                "approx_sample_size": {
                  "type": "string"
                },
                "available_in_idi": {
                  "type": "string"
                },
                "availability_access": {
                  "type": "string"
                },
                "all_source_links": {
                  "type": "string"
                },
                "zotero_tags": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "page": {
            "type": "integer",
            "minimum": 1
          },
          "per_page": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50
          },
          "totalPages": {
            "type": "integer",
            "minimum": 1
          },
          "facets": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "sourceCategory",
              "typeOfData",
              "availableInIdi"
            ],
            "properties": {
              "sourceCategory": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "typeOfData": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "availableInIdi": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "CatalogueRecord": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "record_id",
          "title",
          "summary",
          "primary_link",
          "source_category",
          "type_of_data",
          "available_in_idi",
          "zotero_tags"
        ],
        "properties": {
          "record_id": {
            "type": "string",
            "description": "Stable NeuroNZ record ID parsed from Zotero extra metadata.",
            "example": "NZNEURO-079"
          },
          "zotero_key": {
            "type": "string"
          },
          "zotero_version": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "source_organisation": {
            "type": "string"
          },
          "primary_link": {
            "type": "string",
            "format": "uri"
          },
          "language": {
            "type": "string"
          },
          "source_category": {
            "type": "string"
          },
          "type_of_data": {
            "type": "string"
          },
          "age_group": {
            "type": "string"
          },
          "data_period": {
            "type": "string"
          },
          "design_type": {
            "type": "string"
          },
          "population_coverage": {
            "type": "string"
          },
          "approx_sample_size": {
            "type": "string"
          },
          "available_in_idi": {
            "type": "string"
          },
          "availability_access": {
            "type": "string"
          },
          "all_source_links": {
            "type": "string"
          },
          "zotero_tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "SearchFacets": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "sourceCategory",
          "typeOfData",
          "availableInIdi"
        ],
        "properties": {
          "sourceCategory": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "typeOfData": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "availableInIdi": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "hint"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable machine-readable error code."
              },
              "message": {
                "type": "string",
                "description": "Human-readable summary of what failed."
              },
              "hint": {
                "type": "string",
                "description": "Actionable recovery guidance for agents."
              }
            }
          }
        }
      }
    }
  }
}
