{
  "openapi": "3.1.0",
  "info": {
    "title": "Nexus Arc",
    "version": "1.0.0",
    "description": "Pay-per-call APIs on Arc mainnet."
  },
  "servers": [
    {
      "url": "https://nexus-arc.pryx.dev"
    }
  ],
  "paths": {
    "/v1/screener": {
      "get": {
        "operationId": "screenToken",
        "summary": "Paid token screen",
        "description": "Paid screen against queued criteria ($0.005 USDC over x402 exact). Example: GET /v1/screener?jobId=proof1&hash=0xabc123.",
        "parameters": [
          {
            "name": "jobId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Queued review id (POST /v1/reviews first or 400 NO_CRITERIA)"
          },
          {
            "name": "hash",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Deliverable hash, e.g. ?jobId=proof1&hash=0xabc123"
          },
          {
            "name": "deliverable",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Raw deliverable; recorded via submitReview"
          }
        ],
        "responses": {
          "200": {
            "description": "Screen result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "screen": {
                      "type": "string"
                    },
                    "risk": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Challenge"
                }
              }
            }
          }
        },
        "x-payment-info": {
          "intent": "charge",
          "method": "tempo",
          "amount": "5000",
          "currency": "USDC",
          "network": "eip155:5042"
        }
      }
    },
    "/v1/swap": {
      "post": {
        "operationId": "quoteSwap",
        "summary": "Paid price estimate (not a token swap)",
        "description": "Price estimate for USDC/EURC. No tokens move. $0.01 buys the quote itself via x402.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "tokenIn",
                  "tokenOut",
                  "amountIn"
                ],
                "properties": {
                  "tokenIn": {
                    "type": "string",
                    "enum": [
                      "USDC",
                      "EURC"
                    ]
                  },
                  "tokenOut": {
                    "type": "string",
                    "enum": [
                      "USDC",
                      "EURC"
                    ]
                  },
                  "amountIn": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Quote",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "pair": {
                      "type": "string"
                    },
                    "amountIn": {
                      "type": "string"
                    },
                    "estimatedOut": {
                      "type": "string"
                    },
                    "stopLimit": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "402": {
            "description": "Payment required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Challenge"
                }
              }
            }
          }
        },
        "x-payment-info": {
          "intent": "charge",
          "method": "tempo",
          "amount": "10000",
          "currency": "USDC",
          "network": "eip155:5042"
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "health",
        "summary": "Health check",
        "description": "Liveness probe.",
        "responses": {
          "200": {
            "description": "ok",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/providers": {
      "get": {
        "operationId": "listProviders",
        "summary": "Ranked providers (free)",
        "description": "GET /v1/providers?skill=review&minScore=80. Returns meanScore, jobs, verified badge.",
        "parameters": [
          {
            "name": "skill",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "minScore",
            "in": "query",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked list"
          }
        }
      },
      "post": {
        "operationId": "registerProvider",
        "summary": "Self-register (Bearer SETTLE_SECRET)",
        "responses": {
          "200": {
            "description": "ok"
          },
          "403": {
            "description": "forbidden"
          }
        }
      }
    },
    "/v1/reviews": {
      "get": {
        "operationId": "listReviews",
        "summary": "Review queue (free)",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      },
      "post": {
        "operationId": "queueReview",
        "summary": "Queue criteria (Bearer, insert-only, 409 on conflict)",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/v1/disputes": {
      "get": {
        "operationId": "listDisputes",
        "summary": "Dispute ledger (free)",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      },
      "post": {
        "operationId": "recordDispute",
        "summary": "Record dispute (Bearer)",
        "responses": {
          "200": {
            "description": "ok",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "duplicate": {
                      "type": "boolean",
                      "description": "true when eventId was already recorded"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "eventId",
                  "jobId",
                  "kind",
                  "amount",
                  "refunded"
                ],
                "properties": {
                  "eventId": {
                    "type": "string",
                    "description": "txHash:logIndex \u2014 replays are ignored"
                  },
                  "jobId": {
                    "type": "string"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "completed",
                      "rejected",
                      "expired"
                    ]
                  },
                  "code": {
                    "type": "string",
                    "enum": [
                      "deliverable-mismatch",
                      "quality-fail",
                      "late",
                      "out-of-scope",
                      "spam"
                    ],
                    "description": "required when kind=rejected"
                  },
                  "amount": {
                    "type": "string"
                  },
                  "refunded": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/recon": {
      "get": {
        "operationId": "recon",
        "summary": "Fee recon (free)",
        "description": "feeOwed (0.75% of kind=completed) + refundedTotal; counts by kind.",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/v1/contracts": {
      "get": {
        "operationId": "listContracts",
        "summary": "Contract registry (free)",
        "description": "All NexusJobs deployments, superseded_by chain.",
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/v1/settle-event": {
      "post": {
        "operationId": "settleEvent",
        "summary": "Indexer score feed (Bearer)",
        "responses": {
          "200": {
            "description": "ok",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "duplicate": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "eventId",
                  "provider",
                  "value"
                ],
                "properties": {
                  "eventId": {
                    "type": "string",
                    "description": "txHash:logIndex \u2014 replays are ignored"
                  },
                  "provider": {
                    "type": "string",
                    "pattern": "^0x[0-9a-fA-F]{40}$"
                  },
                  "value": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 10000
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Challenge": {
        "type": "object",
        "properties": {
          "x402Version": {
            "type": "integer"
          },
          "error": {
            "type": "string"
          },
          "accepts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "scheme": {
                  "type": "string"
                },
                "network": {
                  "type": "string"
                },
                "amount": {
                  "type": "string"
                },
                "payTo": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "ApiError": {
        "type": "object",
        "required": [
          "error",
          "code"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "hint": {
            "type": "string"
          }
        }
      }
    }
  }
}
