{
  "openapi": "3.1.0",
  "info": {
    "title": "Teppi",
    "description": "The record of what happened when someone paid a machine service. Every entry carries the settlement transaction, the hashes of what was sent and returned, and the check that ran.",
    "version": "0.1.0"
  },
  "servers": [
    {
      "url": "https://api.teppi.xyz"
    }
  ],
  "paths": {
    "/v1/trust/{id}": {
      "get": {
        "operationId": "getGrade",
        "summary": "Returns the quality grade for a paid endpoint, with the components behind it and a sample of the evidence. Use before paying an endpoint you have not used.",
        "tags": [
          "grade",
          "quality",
          "x402",
          "endpoint"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^cap_[0-9A-HJKMNP-TV-Z]{26}$"
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "ok",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/trust/feed": {
      "get": {
        "operationId": "gradeFeed",
        "summary": "Streams every grade as it is published, newline delimited, resumable from a cursor. Use to mirror the whole record.",
        "tags": [
          "feed",
          "mirror",
          "grade",
          "ndjson"
        ],
        "responses": {
          "200": {
            "description": "ok",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/docs/extract": {
      "post": {
        "operationId": "extractDocument",
        "summary": "Returns structured json extracted from a public pdf or html document url. Use when you have a document link and need typed fields.",
        "tags": [
          "pdf",
          "extract",
          "structured-json",
          "document"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": [
                  "url"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "ok",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "content_type": {
                      "type": "string"
                    },
                    "sha256": {
                      "type": "string",
                      "pattern": "^sha256:[0-9a-f]{64}$"
                    },
                    "bytes": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "pages": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 1
                    },
                    "title": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "headings": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "level": {
                            "type": "integer",
                            "minimum": 1
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "level",
                          "text"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "links": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "href": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "href",
                          "text"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "text": {
                      "type": "string"
                    },
                    "text_chars": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "truncated": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "url",
                    "content_type",
                    "sha256",
                    "bytes",
                    "pages",
                    "title",
                    "headings",
                    "links",
                    "text",
                    "text_chars",
                    "truncated"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "402": {
            "description": "payment required, terms in the body and the payment-required header"
          }
        },
        "x-x402": {
          "amount": "0.020000",
          "asset": "USDC",
          "scheme": "exact",
          "networks": [
            "eip155:8453",
            "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"
          ]
        }
      }
    },
    "/v1/companies/lookup": {
      "post": {
        "operationId": "lookupCompany",
        "summary": "Returns legal entities matching a company name or lei, with jurisdiction, status and registered city, as the global lei registry publishes them.",
        "tags": [
          "company",
          "lei",
          "legal-entity",
          "lookup"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 200
                  }
                },
                "required": [
                  "query"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "ok",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "query": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "gleif"
                      ]
                    },
                    "matches": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "lei": {
                            "type": "string",
                            "pattern": "^[A-Z0-9]{20}$"
                          },
                          "legal_name": {
                            "type": "string"
                          },
                          "jurisdiction": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "registration_status": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "city": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "country": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "last_update": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "lei",
                          "legal_name",
                          "jurisdiction",
                          "status",
                          "registration_status",
                          "city",
                          "country",
                          "last_update"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "query",
                    "source",
                    "matches"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "402": {
            "description": "payment required, terms in the body and the payment-required header"
          }
        },
        "x-x402": {
          "amount": "0.020000",
          "asset": "USDC",
          "scheme": "exact",
          "networks": [
            "eip155:8453",
            "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"
          ]
        }
      }
    },
    "/v1/web/evidence": {
      "post": {
        "operationId": "webEvidence",
        "summary": "Returns source urls and verbatim quotations for a factual query, where every quote can be found at the url it cites.",
        "tags": [
          "search",
          "citation",
          "quote",
          "evidence"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 300
                  }
                },
                "required": [
                  "query"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "ok",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "query": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "brave"
                      ]
                    },
                    "searched": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "fetched": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "citations": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "pattern": "^https:\\/\\/"
                          },
                          "title": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "quote": {
                            "type": "string",
                            "minLength": 24,
                            "maxLength": 2000
                          }
                        },
                        "required": [
                          "url",
                          "title",
                          "quote"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "query",
                    "source",
                    "searched",
                    "fetched",
                    "citations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "402": {
            "description": "payment required, terms in the body and the payment-required header"
          }
        },
        "x-x402": {
          "amount": "0.020000",
          "asset": "USDC",
          "scheme": "exact",
          "networks": [
            "eip155:8453",
            "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"
          ]
        }
      }
    },
    "/v1/research/brief": {
      "post": {
        "operationId": "researchBrief",
        "summary": "Returns a brief on a factual query made only of verbatim quotes from public pages, each numbered to the url it was taken from.",
        "tags": [
          "research",
          "brief",
          "citation",
          "quote"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 300
                  }
                },
                "required": [
                  "query"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "ok",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "query": {
                      "type": "string"
                    },
                    "brief": {
                      "type": "string"
                    },
                    "citations": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "pattern": "^https:\\/\\/"
                          },
                          "title": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "quote": {
                            "type": "string",
                            "minLength": 24,
                            "maxLength": 2000
                          }
                        },
                        "required": [
                          "url",
                          "title",
                          "quote"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "query",
                    "brief",
                    "citations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "402": {
            "description": "payment required, terms in the body and the payment-required header"
          }
        },
        "x-x402": {
          "amount": "0.020000",
          "asset": "USDC",
          "scheme": "exact",
          "networks": [
            "eip155:8453",
            "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"
          ]
        }
      }
    }
  }
}
