openapi: 3.1.0
info:
  title: MergeGate
  description: Deterministic evaluator and conditional USDC settlement for autonomous coding agents. Attests
    verified contract acceptance only, not code quality, security, or mergeworthiness.
  version: 0.1.0
paths:
  /webhooks/github:
    post:
      summary: Receive
      description: 'Accept a signed GitHub push and advance the task it concerns.


        HMAC-verified against the raw body. Deliveries are de-duplicated, and a

        push for a superseded SHA is dropped rather than applied.'
      operationId: receive_webhooks_github_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /:
    get:
      summary: Dashboard
      operationId: dashboard__get
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
  /receipts:
    get:
      summary: Receipts
      description: 'A real page. It previously re-rendered the contracts table, so the

        nav item appeared to do nothing when clicked.'
      operationId: receipts_receipts_get
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
  /api/receipts:
    get:
      summary: Receipts Json
      description: 'The receipt index for programs rather than people.


        ``source_error`` is carried through rather than collapsed into an empty

        list, for the same reason the page shows it: a datastore that is

        unreachable and one that is genuinely empty are different facts, and an

        agent polling for its own settlement must be able to tell them apart.'
      operationId: receipts_json_api_receipts_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response Receipts Json Api Receipts Get
  /api/wallets:
    get:
      summary: Wallets Json
      description: Wallet roles and their live spending policies, for agents.
      operationId: wallets_json_api_wallets_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response Wallets Json Api Wallets Get
  /api/contracts/{contract_hash}:
    get:
      summary: Contract Json
      description: 'The pinned terms behind a contract hash, for a provider agent

        deciding whether to attempt the work.'
      operationId: contract_json_api_contracts__contract_hash__get
      parameters:
      - name: contract_hash
        in: path
        required: true
        schema:
          type: string
          title: Contract Hash
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response Contract Json Api Contracts  Contract Hash  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/receipts/{receipt_id}/advisory:
    get:
      summary: Advisory Json
      description: 'Gemini''s advisory artifacts for one evaluation.


        Served separately from the receipt, and labelled, because none of it is

        signed and none of it decided the settlement.'
      operationId: advisory_json_api_receipts__receipt_id__advisory_get
      parameters:
      - name: receipt_id
        in: path
        required: true
        schema:
          type: string
          title: Receipt Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response Advisory Json Api Receipts  Receipt Id  Advisory Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /receipts/{receipt_id}.json:
    get:
      summary: Receipt Json
      operationId: receipt_json_receipts__receipt_id__json_get
      parameters:
      - name: receipt_id
        in: path
        required: true
        schema:
          type: string
          title: Receipt Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response Receipt Json Receipts  Receipt Id  Json Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /receipts/{receipt_id}:
    get:
      summary: Receipt Detail
      operationId: receipt_detail_receipts__receipt_id__get
      parameters:
      - name: receipt_id
        in: path
        required: true
        schema:
          type: string
          title: Receipt Id
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /evaluations/{receipt_id}:
    get:
      summary: Evaluation
      operationId: evaluation_evaluations__receipt_id__get
      parameters:
      - name: receipt_id
        in: path
        required: true
        schema:
          type: string
          title: Receipt Id
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /contracts/{contract_hash}:
    get:
      summary: Contract
      operationId: contract_contracts__contract_hash__get
      parameters:
      - name: contract_hash
        in: path
        required: true
        schema:
          type: string
          title: Contract Hash
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /judge:
    get:
      summary: Judge
      description: The whole case on one page, built from the receipts on record.
      operationId: judge_judge_get
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
  /verifier:
    get:
      summary: Verifier
      operationId: verifier_verifier_get
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
  /wallets:
    get:
      summary: Wallets
      description: 'The spending policy each agent wallet runs under.


        Read live from Circle rather than described, because "agents move money

        autonomously" is only reassuring if the autonomy is bounded, and a

        bound nobody can check is a promise rather than a control.'
      operationId: wallets_wallets_get
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
  /integrate:
    get:
      summary: Integrate
      description: 'How another agent talks to MergeGate.


        The sample receipt id is taken from whatever this deployment actually

        holds rather than hardcoded, so the copy-pasteable command works instead

        of 404ing against an id from some other environment.'
      operationId: integrate_integrate_get
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
  /docs:
    get:
      summary: Integrate
      description: 'How another agent talks to MergeGate.


        The sample receipt id is taken from whatever this deployment actually

        holds rather than hardcoded, so the copy-pasteable command works instead

        of 404ing against an id from some other environment.'
      operationId: integrate_docs_get
      responses:
        '200':
          description: Successful Response
          content:
            text/html:
              schema:
                type: string
  /x402/verify:
    get:
      summary: X402 Verify
      description: 'Buy one evaluation over x402. Answers 402 with a payment challenge

        until paid, which is the protocol working rather than an error.'
      operationId: x402_verify_x402_verify_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response X402 Verify X402 Verify Get
  /health:
    get:
      summary: Health
      description: Liveness only. Says nothing about whether settlement is working.
      operationId: health_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties:
                  type: string
                type: object
                title: Response Health Health Get
  /api/status:
    get:
      summary: Status
      description: Status, stated in the same terms the receipts use.
      operationId: status_api_status_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Status Api Status Get
  /api/verification-key:
    get:
      summary: Verification Key
      description: 'Publish the public half of the receipt signing key.


        Receipts claimed to be independently verifiable while the key needed to

        verify them existed only in the deployment''s environment, which made the

        claim unexercisable by anyone outside it. Publishing the *public* half is

        the entire point of signing.


        The caveat is served with it rather than left implicit: a key taken from

        the issuer proves the issuer is self-consistent, not that it is honest.

        Pin it out of band to get the guarantee the signature is meant to carry.'
      operationId: verification_key_api_verification_key_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response Verification Key Api Verification Key Get
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
