{
  "openapi": "3.0.3",
  "info": {
    "title": "TronBid Mass USDT Payouts API",
    "version": "2.0",
    "description": "Prepaid TRC-20 USDT batch payouts. Generate keys in the payout dashboard. The default 10 USDT available minimum applies only to issuance. Refunds return to the original payout balance."
  },
  "servers": [
    {
      "url": "https://tronbid.com/api/v2/mass-payouts"
    }
  ],
  "security": [
    {
      "payoutKey": []
    }
  ],
  "components": {
    "securitySchemes": {
      "payoutKey": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "Batch": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "external_id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9._:-]{1,100}$"
          },
          "status": {
            "type": "string"
          },
          "phase": {
            "type": "string"
          },
          "funded_at": {
            "type": "string",
            "nullable": true
          },
          "refunded_usdt": {
            "type": "string",
            "pattern": "^[0-9]+(?:\\.[0-9]{1,6})?$"
          },
          "row_count": {
            "type": "integer",
            "minimum": 0
          },
          "quote": {
            "type": "object",
            "properties": {
              "revision": {
                "type": "string",
                "format": "uuid"
              },
              "expires_at": {
                "type": "string",
                "format": "date-time"
              },
              "total_usdt": {
                "type": "string",
                "pattern": "^[0-9]+(?:\\.[0-9]{1,6})?$"
              },
              "activation_addresses": {
                "type": "integer",
                "minimum": 0
              }
            },
            "nullable": true
          },
          "rows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "external_id": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9._:-]{1,100}$"
                },
                "address": {
                  "type": "string"
                },
                "amount_usdt": {
                  "type": "string",
                  "pattern": "^[0-9]+(?:\\.[0-9]{1,6})?$"
                },
                "status": {
                  "type": "string"
                },
                "txid": {
                  "type": "string",
                  "nullable": true
                },
                "refunded_usdt": {
                  "type": "string",
                  "pattern": "^[0-9]+(?:\\.[0-9]{1,6})?$"
                }
              }
            }
          }
        }
      },
      "DepositInvoice": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "amount_usdt": {
            "type": "string"
          },
          "payment_address": {
            "type": "string"
          },
          "token_contract": {
            "type": "string"
          },
          "network": {
            "type": "string"
          },
          "asset": {
            "type": "string"
          },
          "expires_at": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "awaiting_payment",
              "confirming",
              "credited",
              "expired",
              "manual_review"
            ]
          },
          "txid": {
            "type": "string",
            "nullable": true
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Invalid input",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Invalid partner key",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "Access disabled",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "Not found",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Conflict": {
        "description": "Conflicting payload, expired quote, insufficient funds, or consent required",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Rate limited",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string"
                }
              }
            }
          }
        },
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "string"
            },
            "description": "Seconds before retry"
          }
        }
      },
      "Unavailable": {
        "description": "Temporarily unavailable",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "paths": {
    "/balance": {
      "get": {
        "summary": "Read USDT balances",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "available_usdt": {
                      "type": "string",
                      "pattern": "^[0-9]+(?:\\.[0-9]{1,6})?$"
                    },
                    "reserved_usdt": {
                      "type": "string",
                      "pattern": "^[0-9]+(?:\\.[0-9]{1,6})?$"
                    },
                    "asset": {
                      "type": "string"
                    },
                    "network": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "operationId": "getUsdtBalance"
      }
    },
    "/transactions": {
      "get": {
        "summary": "Read chronological account history, newest first",
        "parameters": [
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "txid": {
                            "type": "string",
                            "nullable": true
                          },
                          "batch_id": {
                            "type": "string",
                            "nullable": true
                          },
                          "available_change_usdt": {
                            "type": "string",
                            "nullable": true
                          },
                          "reserved_change_usdt": {
                            "type": "string",
                            "nullable": true
                          }
                        }
                      }
                    },
                    "next_cursor": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "operationId": "getAccountTransactions"
      }
    },
    "/batches": {
      "post": {
        "summary": "Submit a batch for quotation",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "external_id": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9._:-]{1,100}$"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "external_id": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9._:-]{1,100}$"
                  },
                  "rows": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "external_id": {
                          "type": "string",
                          "pattern": "^[a-zA-Z0-9._:-]{1,100}$"
                        },
                        "address": {
                          "type": "string"
                        },
                        "amount_usdt": {
                          "type": "string",
                          "pattern": "^[0-9]+(?:\\.[0-9]{1,6})?$"
                        }
                      },
                      "required": [
                        "external_id",
                        "address",
                        "amount_usdt"
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 1000
                  }
                },
                "required": [
                  "external_id",
                  "rows"
                ]
              }
            }
          }
        },
        "operationId": "createPayoutBatch"
      },
      "get": {
        "summary": "Recover a batch by external reference",
        "parameters": [
          {
            "name": "external_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9._:-]{1,100}$"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "operationId": "getBatchByExternalId"
      }
    },
    "/batches/{id}": {
      "get": {
        "summary": "Read a batch and page through its rows",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Batch"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "operationId": "getPayoutBatch"
      }
    },
    "/batches/{id}/pay": {
      "post": {
        "summary": "Reserve the total and start payouts",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "funded": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "quote_revision": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "activation_consent": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "quote_revision",
                  "activation_consent"
                ]
              }
            }
          }
        },
        "operationId": "fundPayoutBatch"
      }
    },
    "/batches/{id}/requote": {
      "post": {
        "summary": "Refresh an unpaid quote",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {}
              }
            }
          }
        },
        "operationId": "refreshPayoutQuote"
      }
    },
    "/webhook": {
      "put": {
        "summary": "Register a public HTTPS webhook, or disable it by passing null",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "nullable": true
                    },
                    "secret": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "nullable": true
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "operationId": "configurePayoutWebhook"
      }
    },
    "/deposits": {
      "post": {
        "summary": "Create a TRC-20 USDT deposit invoice",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "201": {
            "description": "Deposit invoice",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepositInvoice"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "amount_usdt"
                ],
                "properties": {
                  "amount_usdt": {
                    "type": "string",
                    "pattern": "^[0-9]+(?:\\.[0-9]{1,6})?$",
                    "example": "50"
                  }
                }
              }
            }
          }
        },
        "operationId": "createUsdtDeposit"
      }
    },
    "/deposits/{id}": {
      "get": {
        "summary": "Get status, exact amount and credited transaction ID",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DepositInvoice"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "operationId": "getUsdtDeposit"
      }
    }
  }
}
