Overview
The Initialize Batch Transaction endpoint compiles an array of flywheel pipelines into Solana transaction instructions and creates a batch transaction that requires approval from both company and project approvers. This endpoint is used to prepare complex multi-action operations that can include token burns, airdrops, buybacks, locks, unlocks, and memo attachments. Each pipeline automatically gets a proof memo prepended to verify the authenticity of the operation based on the provided type and payload.Authentication
This endpoint requires API key authentication. The API key must have eitherburn or airdrop scopes.
To authenticate, provide your API key in the x-believe-api-key request header.
Example:
Rate Limiting
Requests to this endpoint are rate-limited to 10 requests per minute per API key.Request Body
| Field | Type | Required | Description | 
|---|---|---|---|
| pipelines | Array | Yes | Array of pipeline objects containing actions to execute. | 
Pipeline Object
| Field | Type | Required | Description | 
|---|---|---|---|
| type | string | Yes | The type identifier for this pipeline (e.g., “WATCH_AD”, “PRODUCT_PURCHASE”). | 
| payload | string | Yes | JSON string containing the proof data for this pipeline. | 
| actions | Array | Yes | Array of action objects to execute in this pipeline. | 
Action Types
BURN Action
Burns a specified amount of tokens.| Field | Type | Required | Description | 
|---|---|---|---|
| action | string | Yes | Must be “BURN” | 
| amount | number | Yes | Amount of tokens to burn (in whole tokens) | 
AIRDROP Action
Sends tokens to a specified wallet address.| Field | Type | Required | Description | 
|---|---|---|---|
| action | string | Yes | Must be “AIRDROP” | 
| toAddress | string | Yes | Solana wallet address to send tokens to | 
| amount | number | Yes | Amount of tokens to airdrop (in whole tokens) | 
BUYBACK Action (Coming Soon)
Executes a token buyback operation.| Field | Type | Required | Description | 
|---|---|---|---|
| action | string | Yes | Must be “BUYBACK” | 
| amount | number | Yes | Amount of tokens to buyback (in whole tokens) | 
LOCK Action (Coming Soon)
Locks tokens with vesting parameters.| Field | Type | Required | Description | 
|---|---|---|---|
| action | string | Yes | Must be “LOCK” | 
| amount | number | Yes | Amount of tokens to lock (in whole tokens) | 
| vesting | Object | Yes | Vesting parameters for the locked tokens | 
UNLOCK Action (Coming Soon)
Unlocks previously locked tokens.| Field | Type | Required | Description | 
|---|---|---|---|
| action | string | Yes | Must be “UNLOCK” | 
MEMO Action
Adds a memo message to the transaction.| Field | Type | Required | Description | 
|---|---|---|---|
| action | string | Yes | Must be “MEMO” | 
| message | string | Yes | The memo message to attach | 
Example Request
Response Body
On success, the API returns a JSON object with the following fields:| Field | Type | Description | 
|---|---|---|
| proposalApproveTx | string | Base64-encoded serialized transaction that must be signed with your registered wallet address (the one used during flywheel registration) | 
| batch | Object | The batch object containing details about the compiled pipelines | 
Example Response (Success)
Important Notes
- Proof Memos: Each pipeline automatically gets a proof memo prepended to its actions. This memo contains a hash of the type and payload for verification purposes.
- Transaction Size Limits: Each pipeline must fit within a single Solana transaction (max ~900 bytes of instruction data). Pipelines that are too large will be rejected.
- 
Approval Required: The returned proposalApproveTxmust be signed with your registered wallet address (the wallet address you provided during flywheel registration). This transaction requires approval from both the company approver and your project approver wallet before execution.
- 
Action Limitations: Currently, only BURN,AIRDROP, andMEMOactions are fully implemented.BUYBACK,LOCK, andUNLOCKactions are coming soon.
- 
Associated Token Accounts: For AIRDROPactions, the endpoint automatically creates associated token accounts for recipients if they don’t exist.
Error Codes
The batch init endpoint can return specific error codes related to the compilation and validation process.| Error Code | Status | Description | 
|---|---|---|
| ERR_TOKEN_NOT_FOUND | 404 | The token associated with the API key could not be found. | 
| ERR_KEY_NOT_FOUND | 404 | The API key could not be found or is invalid. | 
| ERR_FLYWHEEL_NOT_FOUND | 404 | No flywheel is associated with the provided API key. | 
| ERR_BATCH_INIT_FAILED | 500 | Failed to compile pipelines or initialize the batch transaction. | 
| ERR_FLYWHEEL_ACTIONS_EMPTY | 400 | One or more pipelines contain no actions. | 
| ERR_FLYWHEEL_INVALID_ACTION | 400 | One or more actions in the pipelines are invalid or unsupported. | 
| ERR_FLYWHEEL_NO_INSTRUCTIONS | 400 | Pipeline compilation resulted in no transaction instructions. | 
| ERR_FLYWHEEL_PIPELINE_TOO_BIG | 400 | Pipeline contains too many actions to fit in a single Solana transaction. | 
Example Error Response
Authorizations
Headers
A unique key generated by the client to ensure a request is processed at most once.
Body
application/json
Array of flywheel pipelines to compile into batch transaction.
Array of pipeline objects containing actions to execute.