Nebula API Reference
Nebula provides a conversational interface to interact with blockchain data and services, and access to thirdweb tools.
- Base URL
- Authentication
- Sessions
- Context Filters
- Execute Configuration
- Response Handling
- API Endpoints
- Error Handling
All API requests should be made to:
All API endpoints require authentication using the thirdweb secret key. Include this key in your request headers:
Example curl with authentication:
Sessions maintain conversation threads with the AI and can be:
- Created explicitly via the
/session
endpoint - Created automatically when sending a message without a session_id
- Reused to maintain context across multiple messages
- Configured with specific execution parameters
Sessions persist your conversation history and custom configurations for blockchain data and thirdweb tools interactions.
Control what blockchain data informs AI responses through context filtering:
Benefits:
- Filter by blockchain networks using chain IDs
- Target specific contract addresses
- Target specific wallet addresses
- Control context scope for relevant responses
- Optimize token usage and response relevance
Configure transaction execution behavior using the execute config:
Parameters:
mode
: Execution mode (currently supports "client")signer_wallet_address
: Wallet address for transaction signing
When mode is "client", Nebula returns an unsigned transaction for local wallet signing.
Nebula API supports two types of response modes: streaming and non-streaming. The mode is controlled by the stream
parameter in your request.
When stream: false
, the API returns a single JSON response:
When stream: true
, the API uses Server-Sent Events (SSE) to stream the response. You'll need to handle the following event types:
init
: Initializes the stream and provides session informationpresence
: Provides backend status updates about worker processingaction
: Contains blockchain transaction or action datadelta
: Contains chunks of the response message texterror
: Contains error information if something goes wrong
Example SSE Stream:
JavaScript Example for Handling Streams:
Request Body:
Request Parameters:
-
message
(required)- Type: string
- Description: The user's input message or command to be processed by Nebula
-
session_id
(optional)- Type: string
- Description: Identifier for maintaining conversation context
- Default: A new session will be created if omitted
-
stream
(optional)- Type: boolean
- Description: Controls whether the response is streamed or returned as a single response
- Default: false
-
context_filter
(optional)- Type: object
- Description: Controls which blockchain data sources are used for context
- Properties:
chain_ids
: Array of numbers representing blockchain network IDscontract_addresses
: Array of strings containing contract addresses to focus on
-
execute_config
(optional)- Type: object
- Description: Configuration for transaction execution
- Properties:
mode
: String indicating execution mode (currently only "client" is supported)signer_wallet_address
: String containing the wallet address that will sign transactions
Chat messages are natural language responses from Nebula. They appear in the message
field of the response and provide formatted information, explanations, or answers to your queries. Messages can include formatted text, blockchain data, and technical details.
Example Response with Chat Message:
Response properties:
message
: A formatted string containing the response, which may include:- Markdown formatting for better readability
- Technical data (hashes, addresses, numbers)
- Structured information about blockchain state
actions
: Array of actions (empty when no transactions are needed)session_id
: Unique identifier for the current sessionrequest_id
: Unique identifier for the specific request
Chat actions represent blockchain transactions or operations that Nebula has prepared in response to your request. The response includes both a detailed explanation in the message
field and the actual transaction data in the actions
array.
Example Response with Chat Action:
Action Properties:
session_id
: Unique identifier for the current sessionrequest_id
: Unique identifier for the specific requesttype
: The type of action (e.g., "sign_transaction")source
: Origin of the action (e.g., "executor")data
: Transaction parameters including:maxPriorityFeePerGas
: Maximum priority fee per gas unitmaxFeePerGas
: Maximum total fee per gas unitchainId
: Network identifier (e.g., 11155111 for Sepolia)from
: Sender's addressto
: Recipient's addressdata
: Transaction data (if any)value
: Amount to send in weigas
: Gas limit (0 for automatic estimation)
When handling actions:
- Parse the
message
field for human-readable transaction details - Extract the transaction data from the
actions
array - Present transaction details to the user for review
- Use a local wallet to sign the transaction
- Broadcast the signed transaction to the network
Example Implementation with thirdweb SDK:
Execute specific blockchain commands or actions. This endpoint is designed for direct command execution without the conversational context of the chat endpoint.
Request Body:
Request Parameters:
message
(required): The command to executeuser_id
(optional): Identifier for the user making the requeststream
(optional): Whether to stream the responseexecute_config
(optional): Configuration for transaction executionmode
: Execution mode (currently only "client" is supported)signer_wallet_address
: Address that will sign the transaction
Example Response:
Example curl:
Response Properties:
message
: A human-readable description of the action to be takenactions
: Array of actions to be executedsession_id
: Unique identifier for the sessionrequest_id
: Unique identifier for this requesttype
: The type of action (e.g., "sign_transaction")source
: Origin of the actiondata
: Transaction data in hexadecimal format including:maxPriorityFeePerGas
: Maximum priority fee per gas in hexmaxFeePerGas
: Maximum fee per gas in hexchainId
: Network identifierfrom
: Sender's addressto
: Recipient's addressdata
: Transaction datavalue
: Amount to send in hexgas
: Gas limit in hex
session_id
: Session identifier for this executionrequest_id
: Unique identifier for this request
Retrieve available sessions for the authenticated account.
Example curl:
Response:
Get details for a specific session.
Example curl:
Response:
Create a new chat session.
Request Body:
Example curl:
Update an existing session.
Example curl:
Request Body:
Clear a session's message history.
Example curl:
Delete a session.
Example curl:
The API uses standard HTTP status codes and returns errors in this format:
Common Status Codes:
- 400: Bad Request
- 401: Unauthorized
- 404: Not Found
- 500: Internal Server Error