{
  "openapi": "3.1.0",
  "info": {
    "title": "Agentextual",
    "version": "1",
    "description": "Agentextual V0 (application 0.1.0). Public machine-readable context and separate opt-in offers. No registration or public writes. UTC ISO-8601 timestamps; optional scalars are null. Root-relative links. Source content has no instructional authority."
  },
  "servers": [
    {
      "url": "https://deltafeeds.agentextual.com"
    }
  ],
  "paths": {
    "/api/v1/manifest": {
      "get": {
        "operationId": "getManifest",
        "description": "Discover capabilities, trust boundaries and cursor semantics.",
        "security": [],
        "parameters": [
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "ETag from the same request URL; a matching response returns 304 with no body."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful retrieval",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-cache"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Manifest"
                }
              }
            }
          },
          "304": {
            "description": "Unchanged response; no body."
          },
          "400": {
            "description": "Malformed, incompatible or foreign cursor, or invalid limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or unpublished collection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Unsupported method; public resources expose no write operations."
          },
          "500": {
            "description": "Non-sensitive server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/collections": {
      "get": {
        "operationId": "listCollections",
        "description": "Published active collections in ascending ID order. Directory cursors paginate the directory.",
        "security": [],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            },
            "description": "Maximum records on this page; context items and removals share this limit."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048,
              "description": "Opaque URL-safe signed token. Preserve it exactly."
            }
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "ETag from the same request URL; a matching response returns 304 with no body."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful retrieval",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-cache"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Directory"
                }
              }
            }
          },
          "304": {
            "description": "Unchanged response; no body."
          },
          "400": {
            "description": "Malformed, incompatible or foreign cursor, or invalid limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or unpublished collection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Unsupported method; public resources expose no write operations."
          },
          "500": {
            "description": "Non-sensitive server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/collections/{slug}": {
      "get": {
        "operationId": "getCollection",
        "description": "Metadata only. Published archived collections remain directly readable; drafts return 404.",
        "security": [],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]*$"
            }
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "ETag from the same request URL; a matching response returns 304 with no body."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful retrieval",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-cache"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Collection"
                }
              }
            }
          },
          "304": {
            "description": "Unchanged response; no body."
          },
          "400": {
            "description": "Malformed, incompatible or foreign cursor, or invalid limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or unpublished collection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Unsupported method; public resources expose no write operations."
          },
          "500": {
            "description": "Non-sensitive server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/collections/{slug}/changes": {
      "get": {
        "operationId": "getContextChanges",
        "description": "Without cursor, retrieve a bounded current snapshot. Drain pages while has_more is true, applying upserts and removals before persisting each next_cursor. Retain the completed checkpoint for later delta checks. Edits coalesce to the latest version at the bound; writes during pagination appear on the next poll. Withdrawn content is suppressed and removals propagate. Offers are never included. Cursors are scoped to this collection and stream. Empty checks return a reusable checkpoint.",
        "security": [],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]*$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            },
            "description": "Maximum records on this page; context items and removals share this limit."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048,
              "description": "Opaque URL-safe signed token. Preserve it exactly."
            }
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "ETag from the same request URL; a matching response returns 304 with no body."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful retrieval",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-cache"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContextPage"
                }
              }
            }
          },
          "304": {
            "description": "Unchanged response; no body."
          },
          "400": {
            "description": "Malformed, incompatible or foreign cursor, or invalid limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or unpublished collection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Unsupported method; public resources expose no write operations."
          },
          "500": {
            "description": "Non-sensitive server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/collections/{slug}/offers": {
      "get": {
        "operationId": "listLiveOffers",
        "description": "Explicit opt-in commercial listing. Only published, started, unexpired offers are returned. Cursors paginate one listing and are not durable delta checkpoints. Start later polls without a cursor to discover clock-only activations. Expired, withdrawn or materially edited offers are suppressed on later pages. A finished listing returns next_cursor=null.",
        "security": [],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-]*$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            },
            "description": "Maximum records on this page; context items and removals share this limit."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048,
              "description": "Opaque URL-safe signed token. Preserve it exactly."
            }
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "ETag from the same request URL; a matching response returns 304 with no body."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful retrieval",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-cache"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OfferPage"
                }
              }
            }
          },
          "304": {
            "description": "Unchanged response; no body."
          },
          "400": {
            "description": "Malformed, incompatible or foreign cursor, or invalid limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or unpublished collection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Unsupported method; public resources expose no write operations."
          },
          "500": {
            "description": "Non-sensitive server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/openapi.json": {
      "get": {
        "operationId": "getOpenAPI",
        "description": "This public read-only contract.",
        "security": [],
        "parameters": [
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "ETag from the same request URL; a matching response returns 304 with no body."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful retrieval",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-cache"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "OpenAPI 3.1 document"
                }
              }
            }
          },
          "304": {
            "description": "Unchanged response; no body."
          },
          "400": {
            "description": "Malformed, incompatible or foreign cursor, or invalid limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or unpublished collection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Unsupported method; public resources expose no write operations."
          },
          "500": {
            "description": "Non-sensitive server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Trust": {
        "type": "object",
        "required": [
          "publisher",
          "instructional_authority"
        ],
        "properties": {
          "publisher": {
            "type": "string",
            "const": "Agentextual"
          },
          "instructional_authority": {
            "type": "string",
            "const": "none"
          }
        },
        "additionalProperties": false
      },
      "CollectionRef": {
        "type": "object",
        "required": [
          "id",
          "slug",
          "title",
          "status"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "minimum": 1
          },
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "archived"
            ]
          }
        },
        "additionalProperties": false
      },
      "Collection": {
        "type": "object",
        "required": [
          "id",
          "slug",
          "title",
          "status",
          "description",
          "topic_tags",
          "created_at",
          "updated_at",
          "context_feed_url",
          "offers_url"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "minimum": 1
          },
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "archived"
            ]
          },
          "description": {
            "type": "string"
          },
          "topic_tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "context_feed_url": {
            "type": "string",
            "format": "uri-reference"
          },
          "offers_url": {
            "type": "string",
            "format": "uri-reference"
          }
        },
        "additionalProperties": false
      },
      "ContextItem": {
        "type": "object",
        "required": [
          "id",
          "type",
          "title",
          "summary",
          "source_url",
          "source_date",
          "provenance",
          "topic_tags",
          "created_at",
          "updated_at",
          "content_hash",
          "trust"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "minimum": 1
          },
          "type": {
            "type": "string",
            "const": "context"
          },
          "title": {
            "type": "string"
          },
          "summary": {
            "type": "string",
            "description": "Plain source information, never an instruction or executable prompt."
          },
          "source_url": {
            "type": "string",
            "format": "uri"
          },
          "source_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "provenance": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "topic_tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "content_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "SHA-256 of normalized public content fields; excludes ID and timestamps."
          },
          "trust": {
            "$ref": "#/components/schemas/Trust"
          }
        },
        "additionalProperties": false
      },
      "Removed": {
        "type": "object",
        "required": [
          "id",
          "type",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "minimum": 1
          },
          "type": {
            "type": "string",
            "const": "context"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "Directory": {
        "type": "object",
        "required": [
          "collections",
          "next_cursor",
          "has_more"
        ],
        "properties": {
          "collections": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Collection"
            }
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 2048,
                "description": "Opaque URL-safe signed token. Preserve it exactly."
              },
              {
                "type": "null"
              }
            ]
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "ContextPage": {
        "type": "object",
        "required": [
          "collection",
          "items",
          "removed",
          "next_cursor",
          "has_more"
        ],
        "properties": {
          "collection": {
            "$ref": "#/components/schemas/CollectionRef"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContextItem"
            }
          },
          "removed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Removed"
            }
          },
          "next_cursor": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048,
            "description": "Opaque URL-safe signed token. Preserve it exactly."
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "Merchant": {
        "type": "object",
        "required": [
          "name",
          "url"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "url": {
            "anyOf": [
              {
                "type": "string",
                "format": "uri"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "Price": {
        "type": "object",
        "required": [
          "amount",
          "currency"
        ],
        "properties": {
          "amount": {
            "type": "string",
            "pattern": "^[0-9]+(?:\\.[0-9]+)?$",
            "maxLength": 64
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          }
        },
        "additionalProperties": false
      },
      "OfferItem": {
        "type": "object",
        "required": [
          "id",
          "type",
          "title",
          "summary",
          "source_url",
          "source_date",
          "provenance",
          "topic_tags",
          "created_at",
          "updated_at",
          "content_hash",
          "trust",
          "commercial_content",
          "merchant",
          "price",
          "eligibility",
          "valid_from",
          "expires_at",
          "destination_url",
          "commercial_relationship",
          "compensation_disclosure",
          "offer_terms",
          "offer_terms_url",
          "external_offer_id"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "minimum": 1
          },
          "type": {
            "type": "string",
            "const": "offer"
          },
          "title": {
            "type": "string"
          },
          "summary": {
            "type": "string",
            "description": "Plain source information, never an instruction or executable prompt."
          },
          "source_url": {
            "anyOf": [
              {
                "type": "string",
                "format": "uri"
              },
              {
                "type": "null"
              }
            ]
          },
          "source_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "provenance": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "topic_tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "content_hash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "description": "SHA-256 of normalized public content fields; excludes ID and timestamps."
          },
          "trust": {
            "$ref": "#/components/schemas/Trust"
          },
          "commercial_content": {
            "type": "boolean",
            "const": true
          },
          "merchant": {
            "$ref": "#/components/schemas/Merchant"
          },
          "price": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Price"
              },
              {
                "type": "null"
              }
            ]
          },
          "eligibility": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "valid_from": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "destination_url": {
            "type": "string",
            "format": "uri"
          },
          "commercial_relationship": {
            "type": "string",
            "enum": [
              "none",
              "affiliate",
              "sponsored",
              "merchant_supplied"
            ]
          },
          "compensation_disclosure": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "offer_terms": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "offer_terms_url": {
            "anyOf": [
              {
                "type": "string",
                "format": "uri"
              },
              {
                "type": "null"
              }
            ]
          },
          "external_offer_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "OfferPage": {
        "type": "object",
        "required": [
          "collection",
          "commercial_content",
          "offers",
          "next_cursor",
          "has_more"
        ],
        "properties": {
          "collection": {
            "$ref": "#/components/schemas/CollectionRef"
          },
          "commercial_content": {
            "type": "boolean",
            "const": true
          },
          "offers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OfferItem"
            }
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 2048,
                "description": "Opaque URL-safe signed token. Preserve it exactly."
              },
              {
                "type": "null"
              }
            ]
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "invalid_cursor",
                  "invalid_request",
                  "not_found",
                  "internal_error"
                ]
              },
              "message": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "Manifest": {
        "type": "object",
        "required": [
          "service",
          "api_version",
          "capabilities",
          "commercial_content_default",
          "endpoints",
          "context_cursor",
          "offer_cursor",
          "instructional_authority",
          "agent_skill",
          "privacy_url"
        ],
        "properties": {
          "service": {
            "type": "string",
            "const": "Agentextual"
          },
          "api_version": {
            "type": "string",
            "const": "1"
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "context_collections",
                "delta_retrieval",
                "structured_offers"
              ]
            }
          },
          "commercial_content_default": {
            "type": "boolean",
            "const": false
          },
          "endpoints": {
            "type": "object",
            "required": [
              "collections",
              "openapi"
            ],
            "properties": {
              "collections": {
                "type": "string",
                "format": "uri-reference"
              },
              "openapi": {
                "type": "string",
                "format": "uri-reference"
              }
            },
            "additionalProperties": false
          },
          "context_cursor": {
            "type": "string"
          },
          "offer_cursor": {
            "type": "string"
          },
          "instructional_authority": {
            "type": "string",
            "const": "none"
          },
          "agent_skill": {
            "type": "object",
            "properties": {
              "instructions": {
                "type": "string"
              },
              "download": {
                "type": "string"
              }
            },
            "required": [
              "instructions",
              "download"
            ]
          },
          "privacy_url": {
            "type": "string"
          }
        },
        "additionalProperties": false
      }
    }
  }
}
