### Get All Permissions Example (Bash) Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/authentication.md Example of how to retrieve a list of all wallet permissions using curl. Replace YOUR_TOKEN with your actual access token. ```bash curl http://localhost:3005/auth/permissions/get-all \ -H "Authorization: Bearer YOUR_TOKEN" ``` -------------------------------- ### Example Development .env Configuration Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/configuration.md This snippet shows a typical .env file setup for a development environment. It includes settings for server, logging, security, database, queues, caching, API limits, and metrics. ```bash # Server Setup NODE_ENV=development ENGINE_MODE=default PORT=3005 HOST=0.0.0.0 ENABLE_HTTPS=false # Logging LOG_LEVEL=info LOG_SERVICES=server,worker,cache,websocket # Security THIRDWEB_API_SECRET_KEY=your-api-key-here ADMIN_WALLET_ADDRESS=0x... ENCRYPTION_PASSWORD=secure-password-min-8-chars ENABLE_KEYPAIR_AUTH=false # Database POSTGRES_CONNECTION_URL=postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable REDIS_URL=redis://localhost:6379 # Queues SEND_TRANSACTION_QUEUE_CONCURRENCY=200 CONFIRM_TRANSACTION_QUEUE_CONCURRENCY=200 SEND_WEBHOOK_QUEUE_CONCURRENCY=10 # Caching ACCOUNT_CACHE_SIZE=2048 TRANSACTION_HISTORY_COUNT=100000 QUEUE_COMPLETE_HISTORY_COUNT=200 # API Limits GLOBAL_RATE_LIMIT_PER_MIN=24000 # Metrics METRICS_ENABLED=true METRICS_PORT=4001 ``` -------------------------------- ### Get All Permissions Response Example (JSON) Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/authentication.md Example JSON response when retrieving all wallet permissions, showing wallet addresses, optional labels, and their associated permissions. ```json { "result": [ { "walletAddress": "0x1234567890abcdef1234567890abcdef12345678", "label": "admin-wallet", "permissions": ["*:*:*"] }, { "walletAddress": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd", "label": "app-service-account", "permissions": ["backend-wallet:read", "backend-wallet:write", "contract:read"] } ] } ``` -------------------------------- ### Install Dependencies Source: https://github.com/thirdweb-dev/engine/blob/main/contributing.md Run this command to install all necessary project dependencies before making changes. ```bash yarn install ``` -------------------------------- ### Get All Webhooks Example Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/webhooks.md Lists all registered webhooks for the authenticated user using a cURL command. Requires an Authorization header. ```bash curl http://localhost:3005/webhooks/get-all \ -H "Authorization: Bearer YOUR_TOKEN" ``` -------------------------------- ### Get Contract Extensions Example Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/contract.md Example of how to call the endpoint to detect implemented standards on a contract using curl. ```bash curl http://localhost:3005/contract/ethereum/0x1234567890abcdef1234567890abcdef12345678/metadata/extensions \ -H "Authorization: Bearer YOUR_TOKEN" ``` -------------------------------- ### Grant Full Access Example (Bash) Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/authentication.md Example of how to grant full administrative access to a wallet using curl. Replace YOUR_TOKEN with your actual access token. ```bash curl -X POST http://localhost:3005/auth/permissions/grant \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{ "walletAddress": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd", "permissions": ["*:*:*"], "label": "admin-account" }' ``` -------------------------------- ### Deploy to Sepolia Testnet Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/deploy.md Example of initiating a deployment to the Sepolia testnet. ```bash curl -X POST http://localhost:3005/deploy/sepolia/nft-collection ... ``` -------------------------------- ### Grant Permissions Example (Bash) Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/authentication.md Example of how to grant specific backend wallet and contract read permissions using curl. Ensure to replace YOUR_TOKEN with your actual access token. ```bash curl -X POST http://localhost:3005/auth/permissions/grant \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{ "walletAddress": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd", "permissions": ["backend-wallet:read", "backend-wallet:write", "contract:read"], "label": "app-service-account" }' ``` -------------------------------- ### Get All Webhooks Response Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/webhooks.md Example response structure when retrieving all webhooks. Includes details like ID, URL, event type, status, and last triggered information. ```json { "result": [ { "id": 1, "url": "https://example.com/webhooks/engine", "eventType": "ALL_TX", "name": "Transaction Updates", "active": true, "createdAt": "2024-01-15T10:30:00Z", "lastTriggeredAt": "2024-01-15T11:45:23Z", "failureCount": 0 } ] } ``` -------------------------------- ### API Request Example with JavaScript/Node Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/authentication.md Example of making an authenticated API request in JavaScript using the fetch API, demonstrating the inclusion of the Authorization header. ```javascript const response = await fetch('http://localhost:3005/backend-wallet/get-all', { headers: { 'Authorization': 'Bearer engine_token_abc123def456' } }); ``` -------------------------------- ### Get Webhook Event Types Example Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/webhooks.md Retrieves a list of all available event types that can be subscribed to via webhooks. Uses a cURL command and requires authentication. ```bash curl http://localhost:3005/webhooks/events \ -H "Authorization: Bearer YOUR_TOKEN" ``` -------------------------------- ### API Request Example with Python Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/authentication.md Example of making an authenticated API request in Python using the requests library, showing how to set the Authorization header. ```python import requests headers = { 'Authorization': 'Bearer engine_token_abc123def456' } response = requests.get( 'http://localhost:3005/backend-wallet/get-all', headers=headers ) ``` -------------------------------- ### Get Auth Configuration Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/configuration.md Retrieves the current authentication settings, including the domain and encrypted wallet details. Useful for verifying authentication setup. ```json { "result": { "authDomain": "", "authWalletEncryptedJson": "" } } ``` -------------------------------- ### Revoke Permissions Example (Bash) Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/authentication.md Example of how to revoke specific write permissions from a wallet using curl. Replace YOUR_TOKEN with your actual access token. ```bash curl -X POST http://localhost:3005/auth/permissions/revoke \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{ "walletAddress": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd", "permissions": ["backend-wallet:write", "contract:write"] }' ``` -------------------------------- ### Example Contract Types Response Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/deploy.md An example of the JSON response when querying for available contract types. It lists details for NFT Collection and Token contracts. ```json { "result": [ { "type": "nft-collection", "name": "NFT Collection", "description": "A collection of non-fungible tokens", "category": "nft", "features": [ "Mint NFTs", "Burn NFTs", "Set Royalties", "Access Control" ] }, { "type": "token", "name": "Token", "description": "A fungible ERC-20 token", "category": "token", "features": [ "Mint tokens", "Burn tokens", "Set supply cap" ] } ] } ``` -------------------------------- ### Run Engine Locally Source: https://github.com/thirdweb-dev/engine/blob/main/contributing.md Execute this command to start a local instance of Engine for testing your changes. ```bash yarn dev ``` -------------------------------- ### Sign Message Response Example Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/backend-wallet.md Example of the JSON response structure when signing a message, containing the generated signature. ```json { "result": { "signature": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" } } ``` -------------------------------- ### GET /deploy/contract-types Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/deploy.md Retrieves a list of all available prebuilt contract types, including their descriptions and capabilities. ```APIDOC ## GET /deploy/contract-types ### Description Gets a list of available prebuilt contract types with descriptions. ### Method GET ### Endpoint /deploy/contract-types ### Response #### Success Response (200) - **result** (array) - An array of contract type objects. - **type** (string) - The unique identifier for the contract type. - **name** (string) - The display name of the contract type. - **description** (string) - A brief description of the contract type. - **icon** (string) - Optional - URL for the contract type icon. - **category** (string) - Optional - Category the contract type belongs to. - **features** (array) - An array of strings listing the contract's capabilities. ### Request Example ```bash curl http://localhost:3005/deploy/contract-types \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### Response Example ```json { "result": [ { "type": "nft-collection", "name": "NFT Collection", "description": "A collection of non-fungible tokens", "category": "nft", "features": [ "Mint NFTs", "Burn NFTs", "Set Royalties", "Access Control" ] }, { "type": "token", "name": "Token", "description": "A fungible ERC-20 token", "category": "token", "features": [ "Mint tokens", "Burn tokens", "Set supply cap" ] } ] } ``` ``` -------------------------------- ### Get All Permissions Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/authentication.md Retrieves a list of all wallet addresses and their associated permissions. ```APIDOC ## GET /auth/permissions/get-all ### Description Retrieves a list of all wallet addresses and their associated permissions. ### Method GET ### Endpoint /auth/permissions/get-all ### Response #### Success Response (200) - **result** (array) - An array of wallet permission objects. - **walletAddress** (string) - The wallet address. - **label** (string) - Optional - The label associated with the wallet. - **permissions** (string[]) - The list of permissions granted to the wallet. #### Response Example ```json { "result": [ { "walletAddress": "0x1234567890abcdef1234567890abcdef12345678", "label": "admin-wallet", "permissions": ["*:*:*"] }, { "walletAddress": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd", "label": "app-service-account", "permissions": ["backend-wallet:read", "backend-wallet:write", "contract:read"] } ] } ``` ``` -------------------------------- ### Get All Permissions Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Retrieves a list of all granted permissions for all wallet addresses. ```APIDOC ## GET /auth/permissions/get-all ### Description Retrieves a list of all granted permissions for all wallet addresses. ### Method GET ### Endpoint `/auth/permissions/get-all` ### Response #### Success Response (200) - **result** (array) - An array of Permission objects, each detailing a wallet address and its associated permissions ### Response Example ```json { "result": [ { "walletAddress": "0x123...", "permissions": ["read", "write"], "label": "My Wallet" } ] } ``` ``` -------------------------------- ### Get All Chains Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Retrieves a list of all supported blockchain chains. ```APIDOC ## Get All Chains ### Description Retrieves a list of all blockchain chains that the Engine supports. ### Method GET ### Endpoint `/chain/get-all` ### Response #### Success Response (200) - **result** (Array) - An array of chain data objects. ### Response Example ```json { "result": [ { "chainId": 1, "name": "Ethereum Mainnet", "rpcUrl": "https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID" }, { "chainId": 137, "name": "Polygon", "rpcUrl": "https://polygon-rpc.com" } ] } ``` ``` -------------------------------- ### Get Auth Configuration Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/configuration.md Retrieves the current authentication settings for the Engine. ```APIDOC ## GET /configuration/auth ### Description Returns authentication settings. ### Method GET ### Endpoint /configuration/auth ### Response #### Success Response (200) - **result** (object) - Contains the authentication configuration. - **authDomain** (string) - The authentication domain. - **authWalletEncryptedJson** (string) - The encrypted JSON for the authentication wallet. ``` -------------------------------- ### API Request Example with curl Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/authentication.md Shows how to make an authenticated API request using curl, including the Authorization header with a bearer token. ```bash curl http://localhost:3005/backend-wallet/get-all \ -H "Authorization: Bearer engine_token_abc123def456" ``` -------------------------------- ### Get Wallet Configuration Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Retrieves the current wallet configuration settings for the Engine. ```APIDOC ## GET /configuration/wallets ### Description Retrieves the current wallet configuration settings for the Engine. ### Method GET ### Endpoint `/configuration/wallets` ### Response #### Success Response (200) - **result** (object) - The wallet configuration object ### Response Example ```json { "result": { "defaultChainId": 1, "privateKey": "..." } } ``` ``` -------------------------------- ### Get Contract Extensions Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Fetches a list of extensions implemented by a smart contract. ```APIDOC ## GET /contract/:chain/:contractAddress/metadata/extensions ### Description Fetches a list of extensions implemented by a smart contract. ### Method GET ### Endpoint /contract/:chain/:contractAddress/metadata/extensions ### Response #### Success Response (200) - **result** (Array) - List of extension names ``` -------------------------------- ### Mint an NFT via API Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/README.md Example of minting an NFT using the /mint-to endpoint for ERC721 contracts. Requires Authorization and x-backend-wallet-address headers. ```bash curl -X POST http://localhost:3005/contract/ethereum/0x.../erc721/mint-to \ -H "Authorization: Bearer TOKEN" \ -H "x-backend-wallet-address: 0x..." \ -d '{"to": "0x...", "metadata": {"name": "NFT"}}' ``` -------------------------------- ### Publish Contract to Thirdweb Registry Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/deploy.md Execute this command in your terminal to publish a contract to the thirdweb registry. Ensure you have the thirdweb CLI installed. ```bash npx thirdweb publish ``` -------------------------------- ### Get Backend Wallet Balance Configuration Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/configuration.md Retrieves the current minimum balance warning settings for backend wallets. ```APIDOC ## GET /configuration/backend-wallet-balance ### Description Returns minimum balance warning settings. ### Method GET ### Endpoint /configuration/backend-wallet-balance ### Response #### Success Response (200) - **result** (object) - Contains the wallet balance configuration. - **minWalletBalance** (string) - The minimum wallet balance threshold. ``` -------------------------------- ### Get Balance Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/backend-wallet.md Retrieves the ETH and token balances for a specified wallet on a given chain. ```APIDOC ## GET /backend-wallet/:walletAddress/get-balance ### Description Get ETH and token balances for a wallet on a specific chain. ### Method GET ### Endpoint /backend-wallet/:walletAddress/get-balance ### Parameters #### Path Parameters - **walletAddress** (string) - Required - 0x-prefixed EVM address #### Query Parameters - **chain** (string | number) - Required - Chain ID (e.g., "1" for Ethereum) or slug (e.g., "ethereum") - **tokenAddress** (string) - Optional - Token contract address (ERC-20). Omit for ETH ### Response #### Success Response (200) - **result** (object) - An object containing balance details. - **balance** (string) - Wei for ETH, smallest unit for tokens - **displayValue** (string) - Human-readable format - **decimals** (string) - **symbol** (string) - **name** (string) - Optional ### Request Example Get ETH balance: ```bash curl "http://localhost:3005/backend-wallet/0x1234567890abcdef1234567890abcdef12345678/get-balance?chain=1" \ -H "Authorization: Bearer YOUR_TOKEN" ``` Get token balance: ```bash curl "http://localhost:3005/backend-wallet/0x1234567890abcdef1234567890abcdef12345678/get-balance?chain=1&tokenAddress=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### Response Example ```json { "result": { "balance": "5000000000000000000", "displayValue": "5.0", "decimals": "18", "symbol": "ETH", "name": "Ether" } } ``` ``` -------------------------------- ### Get All Backend Wallets Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/backend-wallet.md Lists all backend wallets managed by Engine. Supports pagination via query parameters. ```APIDOC ## GET /backend-wallet/get-all ### Description Lists all backend wallets managed by Engine. Supports pagination. ### Method GET ### Endpoint /backend-wallet/get-all ### Parameters #### Query Parameters - **page** (integer) - Optional - Default: 1 - Page number for pagination (1-indexed) - **limit** (integer) - Optional - Default: 10 - Results per page (1-1000) ### Response #### Success Response (200) - **result** (WalletDetails[]) - An array of wallet details. ### Request Example ```bash curl "http://localhost:3005/backend-wallet/get-all?page=1&limit=20" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### Response Example ```json { "result": [ { "address": "0x1234567890abcdef1234567890abcdef12345678", "type": "local", "label": "payment-wallet", "encryptedJson": null, "platformIdentifiers": null, "credentialId": null, "awsKmsArn": null, "gcpKmsResourcePath": null, "accountSignerAddress": null, "accountFactoryAddress": null, "entrypointAddress": null } ] } ``` ``` -------------------------------- ### Get Webhook Event Types Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/webhooks.md Retrieves a list of all available event types that can be subscribed to via webhooks. Each event type includes a description and a payload example. ```APIDOC ## GET /webhooks/events ### Description Lists all available webhook event types. ### Method GET ### Endpoint /webhooks/events ### Response #### Success Response (200) - **result** (array) - An array of event type objects. - Each object contains: - **eventType** (string) - The identifier for the event type. - **description** (string) - A description of when the event is triggered. - **payloadExample** (object) - An example of the payload structure for this event type. ### Request Example ```bash curl http://localhost:3005/webhooks/events \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### Response Example ```json { "result": [ { "eventType": "ALL_TX", "description": "Any transaction state change", "payloadExample": {} } ] } ``` ``` -------------------------------- ### Deploy a Contract via API Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/README.md Example of deploying a contract using the /deploy endpoint. Requires Authorization and x-backend-wallet-address headers, along with deployment parameters. ```bash curl -X POST http://localhost:3005/deploy/ethereum/nft-collection \ -H "Authorization: Bearer TOKEN" \ -H "x-backend-wallet-address: 0x..." \ -d '{"name": "My NFTs", "symbol": "MYNFT"}' ``` -------------------------------- ### Create Webhook Example Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/webhooks.md Demonstrates how to register a webhook to receive notifications for all transaction events using a cURL command. Includes setting the URL, event type, name, and secret for HMAC verification. ```bash curl -X POST http://localhost:3005/webhooks/create \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{ "url": "https://example.com/webhooks/engine", "eventType": "ALL_TX", "name": "Transaction Updates", "secret": "your-secret-key" }' ``` -------------------------------- ### Example Production .env Configuration Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/configuration.md This snippet illustrates a production environment .env configuration. It emphasizes security best practices like using secrets managers and enables features like HTTPS and trust proxy. ```bash # Server Setup NODE_ENV=production ENGINE_MODE=default PORT=3005 HOST=0.0.0.0 TRUST_PROXY=true ENABLE_HTTPS=true ENGINE_TIER=cloud-hosted # Logging LOG_LEVEL=warn LOG_SERVICES=server,worker # Security (use secrets manager in production) THIRDWEB_API_SECRET_KEY=${SECRET_MANAGER_API_KEY} ADMIN_WALLET_ADDRESS=${SECRET_MANAGER_ADMIN} ENCRYPTION_PASSWORD=${SECRET_MANAGER_ENCRYPTION} ENABLE_KEYPAIR_AUTH=false # Database POSTGRES_CONNECTION_URL=${SECRET_MANAGER_DB_URL} REDIS_URL=${SECRET_MANAGER_REDIS_URL} REDIS_MAXMEMORY=8gb # Queues SEND_TRANSACTION_QUEUE_CONCURRENCY=500 CONFIRM_TRANSACTION_QUEUE_CONCURRENCY=500 SEND_WEBHOOK_QUEUE_CONCURRENCY=50 # Caching ACCOUNT_CACHE_SIZE=8192 TRANSACTION_HISTORY_COUNT=500000 # API Limits GLOBAL_RATE_LIMIT_PER_MIN=100000 # Monitoring METRICS_ENABLED=true DD_TRACER_ACTIVATED=true ``` -------------------------------- ### Execute a Write Function with Simulation Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/contract.md This example demonstrates how to execute a write function on a contract while enabling transaction simulation. This allows you to preview the transaction's outcome before it's broadcasted. Ensure the `simulateTx` query parameter is set to `true`. ```bash curl -X POST "http://localhost:3005/contract/ethereum/0x1234567890abcdef1234567890abcdef12345678/write?simulateTx=true" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "x-backend-wallet-address: 0xabcdefabcdefabcdefabcdefabcdefabcdefabcd" \ -d '{ "functionName": "transfer", "args": ["0xrecipient", "1000"] }' ``` -------------------------------- ### Generate SDK for Engine Tests Source: https://github.com/thirdweb-dev/engine/blob/main/tests/e2e/README.md Run this command from the repository root to generate the necessary SDK for the end-to-end tests. ```bash yarn generate:sdk ``` -------------------------------- ### Get Available Contract Types Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/deploy.md Retrieves a list of all available prebuilt contract types that can be deployed. This includes their names, descriptions, and supported features. ```bash curl http://localhost:3005/deploy/contract-types \ -H "Authorization: Bearer YOUR_TOKEN" ``` -------------------------------- ### Get All Relayers Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Retrieves a list of all configured relayers. ```APIDOC ## Get All Relayers ### Description Fetches a list of all relayers that have been configured in the Engine. ### Method GET ### Endpoint `/relayer/get-all` ### Response #### Success Response (200) - **result** (Array) - An array of relayer objects. ### Response Example ```json { "result": [ { "id": "relayer-123", "name": "MyPolygonRelayer", "chainId": 137, "backendWalletAddress": "0x1234567890abcdef1234567890abcdef12345678", "createdAt": "2023-10-27T10:00:00Z" } ] } ``` ``` -------------------------------- ### Create Local Backend Wallet Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/backend-wallet.md Use this endpoint to create a new local backend wallet. Provide a label for easier identification. ```bash curl -X POST http://localhost:3005/backend-wallet/create \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{"type": "local", "label": "payment-wallet"}' ``` ```json { "result": { "walletAddress": "0x1234567890abcdef1234567890abcdef12345678", "status": "success", "type": "local" } } ``` -------------------------------- ### Create Smart Account Wallet Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/backend-wallet.md Use this endpoint to create a new smart account wallet with a local KMS provider. A label is recommended for organization. ```bash curl -X POST http://localhost:3005/backend-wallet/create \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{"type": "smart:local", "label": "smart-wallet"}' ``` -------------------------------- ### Get All Wallet Subscriptions Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Retrieves a list of all active wallet subscriptions. ```APIDOC ## Get All Wallet Subscriptions ### Description Fetches a list of all currently active subscriptions for wallet events. ### Method GET ### Endpoint `/wallet-subscriptions/get-all` ### Response #### Success Response (200) - **result** (Array) - An array of wallet subscription objects. ### Response Example ```json { "result": [ { "id": "wallet-sub-456", "chain": 1, "walletAddress": "0xWalletAddress", "processEventLogs": true } ] } ``` ``` -------------------------------- ### Create Webhook - POST Request Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/README.md Use this endpoint to create a new webhook. Ensure you replace 'TOKEN' with your actual authorization token and provide a valid URL and event type. ```bash curl -X POST http://localhost:3005/webhooks/create \ -H "Authorization: Bearer TOKEN" \ -d '{"url": "https://example.com/webhook", "eventType": "ALL_TX"}' ``` -------------------------------- ### Real-time Event Webhooks Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/README.md Set up and manage real-time event webhooks. This includes creating and managing webhook subscriptions, defining event types and payloads, verifying HMAC signatures, and configuring retry policies. Examples for Slack notifications and database sync are provided. ```APIDOC ## Real-time Event Webhooks ### Description Endpoints for managing real-time event webhooks. Allows users to create and manage webhook subscriptions, define event types and their corresponding payloads, verify incoming webhook signatures using HMAC, and configure retry policies for failed deliveries. Includes best practices and examples. ### Endpoint Categories - Create and manage webhooks - Event types and payloads - HMAC signature verification - Retry policy - Best practices and examples - Slack notifications and database sync examples ### Total Endpoints 5 ``` -------------------------------- ### Add Keypair for Authentication Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/authentication.md Use this endpoint to add a public key for keypair authentication. Ensure `ENABLE_KEYPAIR_AUTH` is set to true. ```bash POST /auth/keypair/add { "publicKey": "0x..." // Public key in hex format } ``` -------------------------------- ### Get All Contract Events Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Retrieves a list of all contract events monitored by the Engine. ```APIDOC ## Get All Contract Events ### Description Fetches a list of all contract events that the Engine is configured to monitor. ### Method GET ### Endpoint `/contract/events/get-all` ### Response #### Success Response (200) - **result** (Array) - An array of contract event objects. ### Response Example ```json { "result": [ { "name": "Transfer", "contractAddress": "0x...", "chainId": 1 } ] } ``` ``` -------------------------------- ### Import Backend Wallet Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Imports an existing wallet (local, AWS KMS, or GCP KMS) into the system. ```APIDOC ## POST /backend-wallet/import ### Description Imports an existing wallet (local, AWS KMS, or GCP KMS) into the system. ### Method POST ### Endpoint /backend-wallet/import ### Parameters #### Request Body - **type** (enum) - `local`, `awsKms`, or `gcpKms` - **privateKey** (string) - Private key (for local wallets) - **label** (string, optional) - Wallet label - Various KMS-specific fields depending on type ### Response #### Success Response (200) - **result** (object) - Contains wallet details - **walletAddress** (string) - **status** (string) - **type** (string) ### Response Example { "result": { "walletAddress": "0x...", "status": "imported", "type": "local" } } ``` -------------------------------- ### Get Chain Data Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Retrieves detailed data for a specific blockchain chain. ```APIDOC ## Get Chain Data ### Description Fetches detailed information about a specific blockchain chain identified by its ID or slug. ### Method GET ### Endpoint `/chain/:chain` ### Parameters #### Path Parameters - **chain** (string) - Required - Chain ID or slug ### Response #### Success Response (200) - **result** (ChainData) - An object containing the chain's data. ### Response Example ```json { "result": { "chainId": 1, "name": "Ethereum Mainnet", "rpcUrl": "https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID" } } ``` ``` -------------------------------- ### Get Chain Configuration Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Retrieves the current chain configuration settings for the Engine. ```APIDOC ## GET /configuration/chains ### Description Retrieves the current chain configuration settings for the Engine. ### Method GET ### Endpoint `/configuration/chains` ### Response #### Success Response (200) - **result** (object) - The chain configuration object ### Response Example ```json { "result": { "supportedChains": [ { "chainId": 1, "rpcUrl": "https://mainnet.infura.io/v3/YOUR_INFURA_KEY" } ] } } ``` ``` -------------------------------- ### Import Backend Wallet Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/README.md Imports an existing private key to create a new backend wallet. ```APIDOC ## POST /backend-wallet/import ### Description Imports an existing private key to create a new backend wallet. Ensure the private key is securely handled. ### Method POST ### Endpoint `/backend-wallet/import` ``` -------------------------------- ### Get ERC-20 Total Supply Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Fetches the total supply of an ERC-20 token. ```APIDOC ## GET /contract/:chain/:contractAddress/erc20/total-supply ### Description Fetches the total supply of an ERC-20 token. ### Method GET ### Endpoint /contract/:chain/:contractAddress/erc20/total-supply ### Response #### Success Response (200) - **result** (object) - Total supply details - **value** (string) - Total supply value - **displayValue** (string) - Total supply display value ``` -------------------------------- ### Gas Estimation Best Practices Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/contract.md Guidelines for gas estimation in contract interactions. Omit 'gasLimit'/'gas' for automatic estimation, but provide explicit limits for complex operations or deployments. Use simulation to validate transactions. ```text - Omit `gasLimit`/`gas` for automatic estimation - Provide explicit limits for: - Complex operations - Deployments - Unusual contract patterns - Use simulation (`simulateTx=true`) to validate before queuing ``` -------------------------------- ### Get Contract Events Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Retrieves metadata for all events emitted by a smart contract. ```APIDOC ## GET /contract/:chain/:contractAddress/metadata/events ### Description Retrieves metadata for all events emitted by a smart contract. ### Method GET ### Endpoint /contract/:chain/:contractAddress/metadata/events ### Response #### Success Response (200) - **result** (Array) - Metadata for each event ``` -------------------------------- ### Deploy Prebuilt Contract Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Deploys a prebuilt contract to a specified chain. Requires the chain identifier, contract type, and deployer wallet address. The request body should contain contract-specific configuration details. ```APIDOC ## POST /deploy/:chain/:contractType ### Description Deploys a prebuilt contract to a specified chain. Requires the chain identifier, contract type, and deployer wallet address. The request body should contain contract-specific configuration details. ### Method POST ### Endpoint `/deploy/:chain/:contractType` ### Parameters #### Path Parameters - **chain** (string) - Required - Chain ID or slug - **contractType** (string) - Required - Type of prebuilt (e.g., `nft-drop`, `token`, `marketplace-v3`) #### Headers - **x-backend-wallet-address** (string) - Required - Deployer wallet ### Request Body Contract-specific configuration ### Response #### Success Response (200) - **result** (object) - Contains deployment details - **deploymentAddress** (string) - The address of the deployed contract - **queueId** (string) - The ID for tracking the deployment transaction ### Request Example ```json { "someConfig": "value" } ``` ### Response Example ```json { "result": { "deploymentAddress": "0x123...", "queueId": "abc-123" } } ``` ``` -------------------------------- ### Get Nonce Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/backend-wallet.md Retrieves the current transaction nonce for a wallet on a specific chain. ```APIDOC ## GET /backend-wallet/:walletAddress/get-nonce ### Description Get the current transaction nonce for a wallet on a specific chain. ### Method GET ### Endpoint /backend-wallet/:walletAddress/get-nonce ### Parameters #### Path Parameters - **walletAddress** (string) - Required - The address of the wallet. #### Query Parameters - **chain** (string | number) - Required - Chain ID or slug ### Response #### Success Response (200) - **result** (object) - **nonce** (number) ### Request Example ```bash curl "http://localhost:3005/backend-wallet/0x1234567890abcdef1234567890abcdef12345678/get-nonce?chain=1" \ -H "Authorization: Bearer YOUR_TOKEN" ``` ### Response Example ```json { "result": { "nonce": 42 } } ``` ``` -------------------------------- ### Authorization Header Format Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/authentication.md Demonstrates the correct format for including access tokens in the Authorization header for API requests. ```bash Authorization: Bearer engine_token_your_token_here ``` -------------------------------- ### Get Wallet Configuration Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/configuration.md Retrieves the configuration for wallet providers used by the Engine. ```APIDOC ## GET /configuration/wallets ### Description Returns wallet provider configuration. ### Method GET ### Endpoint /configuration/wallets ### Response #### Success Response (200) - **result** (object) - An object containing wallet configuration details. - **walletProviderConfigs** (object) - Configuration for different wallet providers. - **aws** (object) - AWS specific configurations. - **defaultAwsRegion** (string) - Default AWS region. - **gcp** (object) - GCP specific configurations. - **defaultGcpKmsLocationId** (string) - Default GCP KMS location ID. - **minWalletBalance** (string) - Minimum required wallet balance. ### Response Example ```json { "result": { "walletProviderConfigs": { "aws": { "defaultAwsRegion": "us-east-1" }, "gcp": { "defaultGcpKmsLocationId": "us-east1-b" } }, "minWalletBalance": "20000000000000000" } } ``` ``` -------------------------------- ### Get All Access Tokens Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Retrieves a list of all access tokens associated with the authenticated account. ```APIDOC ## GET /auth/access-tokens/get-all ### Description Retrieves a list of all access tokens associated with the authenticated account. ### Method GET ### Endpoint `/auth/access-tokens/get-all` ### Response #### Success Response (200) - **result** (array) - An array of AccessToken objects ### Response Example ```json { "result": [ { "id": "tok_abc123", "token": "ey...", "createdAt": "2024-01-01T10:00:00Z", "expiresAt": "2025-01-01T00:00:00Z" } ] } ``` ``` -------------------------------- ### List All Backend Wallets Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/backend-wallet.md Retrieves a paginated list of all backend wallets managed by Engine. Use query parameters 'page' and 'limit' for pagination. ```bash curl "http://localhost:3005/backend-wallet/get-all?page=1&limit=20" \ -H "Authorization: Bearer YOUR_TOKEN" ``` -------------------------------- ### Get NFT Total Supply Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Fetches the total number of NFTs minted for a contract. ```APIDOC ## GET /contract/:chain/:contractAddress/erc721/total-count ### Description Fetches the total number of NFTs minted for a contract. ### Method GET ### Endpoint /contract/:chain/:contractAddress/erc721/total-count ### Response #### Success Response (200) - **result** (object) - **value** (string) - The total count of NFTs ``` -------------------------------- ### Send a Transaction via API Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/README.md Example of sending a transaction using the /send-transaction endpoint. Ensure the Authorization header and backend wallet address are correctly set. ```bash curl -X POST http://localhost:3005/backend-wallet/0x.../send-transaction \ -H "Authorization: Bearer TOKEN" \ -d '{"chainId": 1, "to": "0x...", "value": "1000000000000000000"}' ``` -------------------------------- ### Get NFT Balance Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Retrieves the number of NFTs owned by a specific wallet address. ```APIDOC ## GET /contract/:chain/:contractAddress/erc721/balance-of ### Description Retrieves the number of NFTs owned by a specific wallet address. ### Method GET ### Endpoint /contract/:chain/:contractAddress/erc721/balance-of ### Parameters #### Query Parameters - **wallet_address** (string) - Required - Wallet address ### Response #### Success Response (200) - **result** (object) - **balance** (string) - The number of NFTs owned ``` -------------------------------- ### Deploy Prebuilt Contract Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/deploy.md Deploys a production-ready thirdweb contract. Supports various contract types like ERC-20 tokens, NFT collections, and marketplaces. ```APIDOC ## POST /deploy/:chain/:contractType ### Description Deploys a production-ready thirdweb contract. The specific parameters required in the request body depend on the `contractType`. ### Method POST ### Endpoint `/deploy/:chain/:contractType` ### Parameters #### Path Parameters - **chain** (string | number) - Required - Chain ID or slug to deploy the contract on. - **contractType** (string) - Required - The type of prebuilt contract to deploy (e.g., `token`, `nft-collection`). #### Headers - **x-backend-wallet-address** (string) - Required - The wallet address that will be used to deploy the contract. - **x-idempotency-key** (string) - Optional - A key to ensure idempotent retries of the deployment request. ### Request Body Body depends on contract type. Common parameters include `name`, `symbol`, `primary_sale_recipient`, and optional `owner` and `txOverrides`. #### Request Example (ERC-20 Token) ```json { "name": "My Token", "symbol": "MYTKN", "primary_sale_recipient": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd", "txOverrides": { "gasLimit": "5000000", "maxFeePerGas": "100000000000", "maxPriorityFeePerGas": "2000000000" } } ``` #### Request Example (NFT Collection) ```json { "name": "My NFT Collection", "symbol": "MYNFT", "primary_sale_recipient": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd", "description": "A collection of amazing NFTs", "image": "https://example.com/image.png", "royalty_recipient": "0x1234567890abcdef1234567890abcdef12345678", "royalty_bps": 500 } ``` ### Response #### Success Response (200 OK) - **result** (object) - Contains deployment details. - **deploymentAddress** (string) - The address of the newly deployed contract. - **queueId** (string) - The ID of the transaction in the deployment queue. - **transactionHash** (string) - The hash of the transaction if it has already been mined. #### Response Example ```json { "result": { "deploymentAddress": "0x1234567890abcdef1234567890abcdef12345678", "queueId": "some-queue-id" } } ``` ### Status Codes - `200 OK`: Deployment queued successfully. - `400 BAD_REQUEST`: Invalid parameters or chain. - `401 UNAUTHORIZED`: Authentication required. - `500 INTERNAL_SERVER_ERROR`: RPC or processing error. ``` -------------------------------- ### Get ERC-20 Balance Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Retrieves the balance of an ERC-20 token for a specific wallet address. ```APIDOC ## GET /contract/:chain/:contractAddress/erc20/balance-of ### Description Retrieves the balance of an ERC-20 token for a specific wallet address. ### Method GET ### Endpoint /contract/:chain/:contractAddress/erc20/balance-of ### Parameters #### Query Parameters - **wallet_address** (string) - Required - Wallet address to check ### Response #### Success Response (200) - **result** (object) - Token balance details - **name** (string) - Token name - **symbol** (string) - Token symbol - **decimals** (string) - Token decimals - **value** (string) - Token value - **displayValue** (string) - Token display value ``` -------------------------------- ### Configuration Interface Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/types.md Represents the overall Engine configuration stored in the database. Includes settings for chains, transactions, indexing, wallets, auth, and more. ```typescript interface Configuration { id: "default"; // Chain Configuration chainOverrides?: string; // JSON with custom chain configs // Transaction Processing minTxsToProcess: number; maxTxsToProcess: number; // Transaction Updates minedTxListenerCronSchedule?: string; maxTxsToUpdate: number; // Retries retryTxListenerCronSchedule?: string; minEllapsedBlocksBeforeRetry: number; maxFeePerGasForRetries: string; maxPriorityFeePerGasForRetries: string; maxRetriesPerTx: number; // Indexing indexerListenerCronSchedule?: string; maxBlocksToIndex: number; cursorDelaySeconds: number; contractSubscriptionsRetryDelaySeconds: string; walletSubscriptionsCronSchedule?: string; // Wallet Configuration walletProviderConfigs: Record; minWalletBalance: string; // Auth authDomain: string; authWalletEncryptedJson: string; // API Configuration accessControlAllowOrigin: string; ipAllowlist: string[]; // Webhook webhookUrl?: string; webhookAuthBearerToken?: string; // Cache clearCacheCronSchedule: string; // Legacy Credentials (deprecated) awsAccessKeyId?: string; awsSecretAccessKey?: string; awsRegion?: string; gcpApplicationProjectId?: string; gcpKmsLocationId?: string; gcpKmsKeyRingId?: string; gcpApplicationCredentialEmail?: string; gcpApplicationCredentialPrivateKey?: string; } ``` -------------------------------- ### Get Nonce Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/endpoints.md Retrieves the next nonce for a given backend wallet on a specific chain. ```APIDOC ## GET /backend-wallet/:walletAddress/get-nonce ### Description Retrieves the next nonce for a given backend wallet on a specific chain. ### Method GET ### Endpoint /backend-wallet/:walletAddress/get-nonce ### Parameters #### Path Parameters - **walletAddress** (string) - The address of the backend wallet #### Query Parameters - **chain** (string|number) - Chain ID or slug ### Response #### Success Response (200) - **result** (object) - **nonce** (number) ### Response Example { "result": { "nonce": 5 } } ``` -------------------------------- ### Get Contract Subscriptions Source: https://github.com/thirdweb-dev/engine/blob/main/_autodocs/api-reference/contract.md Lists all currently active subscriptions for contract event monitoring. ```APIDOC ## GET /contract/subscriptions/get ### Description List active subscriptions. ### Method GET ### Endpoint /contract/subscriptions/get ### Response #### Success Response (200) - **result** (Array) - An array of active contract subscription objects. ```