{
  "openapi": "3.1.0",
  "info": {
    "title": "Slices partner payout API",
    "version": "1.0.0",
    "description": "The v1 contract, served at /v1 by the application. All operations require a project-scoped server API key. Amounts are recipient net amounts; the Slices fee is a separate transfer paid by the operator's wallet. Accepted grants queue into a draft campaign that the partner's operator approves in the dashboard and sends from their own wallet, one exact transfer per reward; Slices holds no signing key and verifies each receipt."
  },
  "servers": [
    {
      "url": "http://localhost:3000",
      "description": "Local development; use the operator-provided HTTPS production origin."
    }
  ],
  "security": [
    {
      "ServerKey": []
    }
  ],
  "tags": [
    {
      "name": "Rewards"
    },
    {
      "name": "Campaigns"
    }
  ],
  "paths": {
    "/v1/rewards": {
      "post": {
        "operationId": "issueReward",
        "summary": "Accept an exact net reward allocation and queue it for operator approval; not synchronous delivery",
        "tags": [
          "Rewards"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Existing instruction replayed; returns its current resource without new economic effects",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              },
              "Idempotency-Replayed": {
                "schema": {
                  "type": "boolean"
                },
                "description": "True for an identical accepted instruction replay"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RewardResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "201": {
            "description": "First durable acceptance",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RewardResponse"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueRewardRequest"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listRewards",
        "summary": "List project-scoped rewards with stable pagination",
        "tags": [
          "Rewards"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "name": "campaignId",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/ResourceId"
            }
          },
          {
            "name": "walletAddress",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/WalletAddress"
            }
          },
          {
            "name": "eventId",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/RewardStatus"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RewardListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/rewards/{rewardId}": {
      "get": {
        "operationId": "getReward",
        "summary": "Read a reward, its status and its transfer evidence",
        "tags": [
          "Rewards"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RewardId"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RewardResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/rewards/{rewardId}/cancel": {
      "post": {
        "operationId": "cancelReward",
        "summary": "Cancel a reward before operator approval and restore capacity once",
        "tags": [
          "Rewards"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RewardId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RewardResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelRewardRequest"
              }
            }
          }
        }
      }
    },
    "/v1/campaigns": {
      "get": {
        "operationId": "listCampaigns",
        "summary": "List project-scoped approved campaigns",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/campaigns/{campaignId}": {
      "get": {
        "operationId": "getCampaign",
        "summary": "Read campaign configuration and capacity accounts",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CampaignId"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Error; consult error.code and requestId",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                },
                "description": "Generated server correlation ID"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ServerKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "High-entropy hashed, scoped server API key. Never expose to a browser."
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 8,
          "maxLength": 128,
          "pattern": "^[A-Za-z0-9._:-]+$"
        }
      },
      "Cursor": {
        "name": "cursor",
        "in": "query",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2048
        }
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 50
        }
      },
      "CampaignId": {
        "name": "campaignId",
        "in": "path",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/ResourceId"
        }
      },
      "RewardId": {
        "name": "rewardId",
        "in": "path",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/ResourceId"
        }
      }
    },
    "schemas": {
      "AmountBaseUnits": {
        "type": "string",
        "pattern": "^(0|[1-9][0-9]{0,77})$",
        "description": "Canonical unsigned integer string; runtime must enforce uint256 maximum."
      },
      "PositiveAmountBaseUnits": {
        "type": "string",
        "pattern": "^[1-9][0-9]{0,77}$",
        "description": "Canonical positive base-unit integer string, at most uint256 max. Never a JS number."
      },
      "WalletAddress": {
        "type": "string",
        "pattern": "^0x[0-9a-fA-F]{40}$",
        "description": "Runtime rejects zero/invalid mixed-case EIP-55 and normalizes other valid casing."
      },
      "Hash32": {
        "type": "string",
        "pattern": "^0x[0-9a-fA-F]{64}$"
      },
      "ResourceId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 96,
        "pattern": "^[A-Za-z0-9_-]+$"
      },
      "RewardStatus": {
        "type": "string",
        "enum": [
          "accepted",
          "queued",
          "approved",
          "sent",
          "delivered",
          "failed",
          "cancelled"
        ]
      },
      "EventReference": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[A-Za-z0-9_.:-]+$"
          }
        },
        "required": [
          "id",
          "type"
        ]
      },
      "Recipient": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "walletAddress": {
            "$ref": "#/components/schemas/WalletAddress"
          }
        },
        "required": [
          "walletAddress"
        ]
      },
      "RewardRecipient": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "walletAddress": {
            "$ref": "#/components/schemas/WalletAddress"
          },
          "verificationStatus": {
            "type": "string",
            "enum": [
              "not_required",
              "unverified",
              "verified",
              "expired",
              "blocked"
            ]
          },
          "verificationUrl": {
            "anyOf": [
              {
                "type": "string",
                "format": "uri",
                "maxLength": 2048
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "walletAddress",
          "verificationStatus",
          "verificationUrl"
        ]
      },
      "Asset": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "chainId": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "tokenAddress": {
            "$ref": "#/components/schemas/WalletAddress"
          },
          "symbol": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "decimals": {
            "type": "integer",
            "minimum": 0,
            "maximum": 255
          }
        },
        "required": [
          "chainId",
          "tokenAddress",
          "symbol",
          "decimals"
        ]
      },
      "IssueRewardRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "campaignId": {
            "$ref": "#/components/schemas/ResourceId"
          },
          "recipient": {
            "$ref": "#/components/schemas/Recipient"
          },
          "amountBaseUnits": {
            "$ref": "#/components/schemas/PositiveAmountBaseUnits"
          },
          "event": {
            "$ref": "#/components/schemas/EventReference"
          }
        },
        "required": [
          "campaignId",
          "recipient",
          "event"
        ],
        "description": "amountBaseUnits is optional when the campaign has a rule for event.type (the rule supplies it) and required otherwise; a supplied amount is always used."
      },
      "CancelRewardRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "required": [
          "reason"
        ]
      },
      "DeliveryEvidence": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "transactionHash": {
            "$ref": "#/components/schemas/Hash32"
          },
          "blockNumber": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AmountBaseUnits"
              },
              {
                "type": "null"
              }
            ]
          },
          "blockHash": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Hash32"
              },
              {
                "type": "null"
              }
            ]
          },
          "confirmations": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AmountBaseUnits"
              },
              {
                "type": "null"
              }
            ]
          },
          "finality": {
            "type": "string",
            "enum": [
              "l2_included",
              "l2_finalized",
              "unknown"
            ]
          },
          "logIndex": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "checkedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "transactionHash",
          "blockNumber",
          "blockHash",
          "confirmations",
          "finality",
          "logIndex",
          "checkedAt"
        ]
      },
      "Reward": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "$ref": "#/components/schemas/ResourceId"
          },
          "campaignId": {
            "$ref": "#/components/schemas/ResourceId"
          },
          "recipient": {
            "$ref": "#/components/schemas/RewardRecipient"
          },
          "asset": {
            "$ref": "#/components/schemas/Asset"
          },
          "amountBaseUnits": {
            "$ref": "#/components/schemas/PositiveAmountBaseUnits"
          },
          "event": {
            "$ref": "#/components/schemas/EventReference"
          },
          "source": {
            "type": "string",
            "const": "partner_attested"
          },
          "status": {
            "$ref": "#/components/schemas/RewardStatus"
          },
          "statusReason": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 256
              },
              {
                "type": "null"
              }
            ]
          },
          "payoutCampaignId": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ResourceId"
              },
              {
                "type": "null"
              }
            ]
          },
          "deliveredAmountBaseUnits": {
            "$ref": "#/components/schemas/AmountBaseUnits"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "deliveryEvidence": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DeliveryEvidence"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "campaignId",
          "recipient",
          "asset",
          "amountBaseUnits",
          "event",
          "source",
          "status",
          "statusReason",
          "payoutCampaignId",
          "deliveredAmountBaseUnits",
          "deliveryEvidence",
          "createdAt",
          "updatedAt"
        ]
      },
      "CampaignBudget": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "authorizedBaseUnits": {
            "$ref": "#/components/schemas/AmountBaseUnits"
          },
          "availableBaseUnits": {
            "$ref": "#/components/schemas/AmountBaseUnits"
          },
          "queuedBaseUnits": {
            "$ref": "#/components/schemas/AmountBaseUnits"
          },
          "approvedBaseUnits": {
            "$ref": "#/components/schemas/AmountBaseUnits"
          },
          "deliveredBaseUnits": {
            "$ref": "#/components/schemas/AmountBaseUnits"
          }
        },
        "required": [
          "authorizedBaseUnits",
          "availableBaseUnits",
          "queuedBaseUnits",
          "approvedBaseUnits",
          "deliveredBaseUnits"
        ]
      },
      "Campaign": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "$ref": "#/components/schemas/ResourceId"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "asset": {
            "$ref": "#/components/schemas/Asset"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused"
            ]
          },
          "issuanceMode": {
            "type": "string",
            "enum": [
              "disabled",
              "canary",
              "live"
            ]
          },
          "budget": {
            "$ref": "#/components/schemas/CampaignBudget"
          },
          "maximumGrantBaseUnits": {
            "$ref": "#/components/schemas/PositiveAmountBaseUnits"
          },
          "verification": {
            "type": "string",
            "enum": [
              "off",
              "required"
            ]
          },
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CampaignRule"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "name",
          "asset",
          "status",
          "issuanceMode",
          "budget",
          "maximumGrantBaseUnits",
          "verification",
          "rules",
          "createdAt"
        ]
      },
      "ErrorDetail": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "INVALID_REQUEST",
              "UNAUTHENTICATED",
              "FORBIDDEN",
              "NOT_FOUND",
              "IDEMPOTENCY_CONFLICT",
              "DUPLICATE_EVENT",
              "INVALID_STATE",
              "BUDGET_EXCEEDED",
              "GRANT_LIMIT_EXCEEDED",
              "RECIPIENT_NOT_ALLOWED",
              "CAMPAIGN_PAUSED",
              "ISSUANCE_DISABLED",
              "PROFILE_NOT_APPROVED",
              "RATE_LIMITED",
              "TEMPORARILY_UNAVAILABLE",
              "INTERNAL_ERROR"
            ]
          },
          "message": {
            "type": "string"
          },
          "requestId": {
            "type": "string",
            "minLength": 1
          },
          "existingRewardId": {
            "$ref": "#/components/schemas/ResourceId"
          }
        },
        "required": [
          "code",
          "message",
          "requestId"
        ]
      },
      "ErrorResponse": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorDetail"
          }
        },
        "required": [
          "error"
        ]
      },
      "RewardResponse": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Reward"
          }
        },
        "required": [
          "data"
        ]
      },
      "RewardListResponse": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Reward"
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CampaignResponse": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Campaign"
          }
        },
        "required": [
          "data"
        ]
      },
      "CampaignListResponse": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Campaign"
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CampaignRule": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "eventType": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[A-Za-z0-9_.:-]+$"
          },
          "amountBaseUnits": {
            "$ref": "#/components/schemas/PositiveAmountBaseUnits"
          },
          "perWalletCapBaseUnits": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PositiveAmountBaseUnits"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "eventType",
          "amountBaseUnits",
          "perWalletCapBaseUnits"
        ]
      }
    }
  }
}
