pub struct Client { /* private fields */ }Expand description
Client for Coinbase Developer Platform APIs
The Coinbase Developer Platform APIs - leading the world’s transition onchain.
Version: 2.0.0
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(baseurl: &str) -> Self
pub fn new(baseurl: &str) -> Self
Create a new client.
baseurl is the base URL provided to the internal
reqwest::Client, and should include a scheme and hostname,
as well as port and a path stem if applicable.
Sourcepub fn new_with_client(baseurl: &str, client: ClientWithMiddleware) -> Self
pub fn new_with_client(baseurl: &str, client: ClientWithMiddleware) -> Self
Construct a new client with an existing reqwest_middleware::ClientWithMiddleware,
allowing more control over its configuration.
baseurl is the base URL provided to the internal
reqwest_middleware::ClientWithMiddleware, and should include a scheme and hostname,
as well as port and a path stem if applicable.
Source§impl Client
impl Client
Sourcepub fn list_foundation_accounts(&self) -> ListFoundationAccounts<'_>
pub fn list_foundation_accounts(&self) -> ListFoundationAccounts<'_>
List accounts
List all accounts. The API will return all accounts that the API Key has Permissions to access. You can filter the results by using query parameters, which will be treated as a single conjunction (i.e. AND). Results are sorted by creation date in descending order (newest first).
Sends a `GET` request to `/v2/accounts`
Arguments:
- `owner`: Filter accounts by owner. Values can be specific Owner IDs or owner type wildcards. Multiple values can be combined as a comma-separated list.
**Specific Owner IDs:**
* `entity_<uuid>` - Accounts owned by a specific entity
* `customer_<uuid>` - Accounts owned by a specific customer
**Owner type wildcards:**
* `entity` - All entity-owned accounts
* `customer` - All customer-owned accounts
**Examples:**
* `owner=customer_af29...` - A specific customer's accounts
* `owner=customer` - All customer accounts
* `owner=entity,customer_af29...` - Entity accounts and a specific customer's accounts
* When omitted, accounts with any owner are returned.
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
- `type_`: Filter accounts by account type. When omitted, accounts of any type are returned. Combined with `owner` using AND.
```ignore
let response = client.list_foundation_accounts()
.owner(owner)
.page_size(page_size)
.page_token(page_token)
.type_(type_)
.send()
.await;
```Sourcepub fn create_foundation_account(&self) -> CreateFoundationAccount<'_>
pub fn create_foundation_account(&self) -> CreateFoundationAccount<'_>
Create account
Create an account. Two ownership modes are supported:
- **Entity-owned**: when `owner` is omitted, the account is owned by the
Entity making the request. Returns an account with `owner: entity_<uuid>`.
Omit `compliance`; it has no effect for Entity-owned accounts.
- **Customer-owned**: pass a Customer ID as `owner`
(e.g. `customer_af2937b0-9846-4fe7-bfe9-ccc22d935114`). The Customer
must have the `custodyCrypto`, `custodyFiat`, and `custodyStablecoin`
capabilities enabled, otherwise the request is rejected with
`customer_not_authorized` (HTTP 403). `compliance.requesterIpAddress`
is required; use the IP address of the end-customer who initiated the
request (not the partner server's IP).
Sends a `POST` request to `/v2/accounts`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.create_foundation_account()
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn get_foundation_account_by_id(&self) -> GetFoundationAccountById<'_>
pub fn get_foundation_account_by_id(&self) -> GetFoundationAccountById<'_>
Get account
Get an account by its ID.
Sends a `GET` request to `/v2/accounts/{accountId}`
Arguments:
- `account_id`: The ID of the account to retrieve.
```ignore
let response = client.get_foundation_account_by_id()
.account_id(account_id)
.send()
.await;
```Sourcepub fn list_balances(&self) -> ListBalances<'_>
pub fn list_balances(&self) -> ListBalances<'_>
List balances for account
List the balances for an account. Results are sorted by native-fiat equivalent balance in descending order.
Sends a `GET` request to `/v2/accounts/{accountId}/balances`
Arguments:
- `account_id`: The unique identifier of the account.
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
```ignore
let response = client.list_balances()
.account_id(account_id)
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Sourcepub fn get_balance_by_asset(&self) -> GetBalanceByAsset<'_>
pub fn get_balance_by_asset(&self) -> GetBalanceByAsset<'_>
Get balance for account
Get the balance for an account by asset.
Sends a `GET` request to `/v2/accounts/{accountId}/balances/{asset}`
Arguments:
- `account_id`: The unique identifier of the account.
- `asset`: The symbol of the asset.
```ignore
let response = client.get_balance_by_asset()
.account_id(account_id)
.asset(asset)
.send()
.await;
```Sourcepub fn list_customers(&self) -> ListCustomers<'_>
pub fn list_customers(&self) -> ListCustomers<'_>
List customers
List all customers. The API will return all customers that the API Key has
permissions to access. Results are not returned in any guaranteed order.
Sends a `GET` request to `/v2/customers`
Arguments:
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
```ignore
let response = client.list_customers()
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Sourcepub fn create_customer(&self) -> CreateCustomer<'_>
pub fn create_customer(&self) -> CreateCustomer<'_>
Create a customer
Create a new customer record. You can optionally request capabilities
and submit verification requirements in the same request.
This endpoint supports creating a customer with:
- Minimal data (customer type only)
- Capability requests
- KYC data submission
- Combined request for capability and required info for verification
Sends a `POST` request to `/v2/customers`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.create_customer()
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn get_customer_requirements(&self) -> GetCustomerRequirements<'_>
pub fn get_customer_requirements(&self) -> GetCustomerRequirements<'_>
Get customer requirements
Preview the requirements a hypothetical customer of the given
`customerType` and jurisdiction would need to satisfy to enable the
requested `capabilities`, without creating a customer record.
Partner onboarding UIs can use this to render the collection flow
before any customer state exists.
Today this endpoint only previews the Terms of Service requirement:
the response's `RequirementsMap` will only ever contain a `tos` key.
Other requirement families (PII / CDD inputs) are not yet available
through this endpoint; use `POST /v2/customers` or
`PUT /v2/customers/{customerId}` to discover those via
`Customer.requirements`.
Only `customerType: individual` customers resident in or citizens
of the US are currently supported; every other combination returns
`400 invalid_request`.
Sends a `GET` request to `/v2/customers/requirements`
Arguments:
- `capabilities`: The capabilities the hypothetical customer would request.
Repeat the parameter to specify multiple capabilities, for
example `capabilities=custodyCrypto&capabilities=transferCrypto`.
- `citizenship`: The hypothetical customer's citizenship. At least one of
`countryCode` or `citizenship` is required.
- `country_code`: The hypothetical customer's country of residence. At least one
of `countryCode` or `citizenship` is required. When both are
present, `countryCode` takes precedence.
- `customer_type`: The type of the hypothetical customer.
```ignore
let response = client.get_customer_requirements()
.capabilities(capabilities)
.citizenship(citizenship)
.country_code(country_code)
.customer_type(customer_type)
.send()
.await;
```Sourcepub fn get_customer_by_id(&self) -> GetCustomerById<'_>
pub fn get_customer_by_id(&self) -> GetCustomerById<'_>
Get a customer
Get a customer by their ID. Returns the full customer object.
Sends a `GET` request to `/v2/customers/{customerId}`
Arguments:
- `customer_id`: The ID of the customer.
```ignore
let response = client.get_customer_by_id()
.customer_id(customer_id)
.send()
.await;
```Sourcepub fn update_customer_by_id(&self) -> UpdateCustomerById<'_>
pub fn update_customer_by_id(&self) -> UpdateCustomerById<'_>
Update a customer
Update customer information and/or request capability changes.
This endpoint supports partial updates. Provide only the fields you wish to change.
Sends a `PUT` request to `/v2/customers/{customerId}`
Arguments:
- `customer_id`: The ID of the customer.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`: Customer fields to update. All fields are optional; omit a field to
leave it unchanged.
```ignore
let response = client.update_customer_by_id()
.customer_id(customer_id)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn delete_customer_by_id(&self) -> DeleteCustomerById<'_>
pub fn delete_customer_by_id(&self) -> DeleteCustomerById<'_>
Delete a customer
Initiates deletion of the customer and all associated data. This operation
is idempotent — repeated calls for an already-deleted customer return 204.
A 404 is returned only when no customer with the given ID exists for the
caller's entity.
Sends a `DELETE` request to `/v2/customers/{customerId}`
Arguments:
- `customer_id`: The ID of the customer.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
```ignore
let response = client.delete_customer_by_id()
.customer_id(customer_id)
.x_idempotency_key(x_idempotency_key)
.send()
.await;
```Sourcepub fn list_data_token_balances(&self) -> ListDataTokenBalances<'_>
pub fn list_data_token_balances(&self) -> ListDataTokenBalances<'_>
List EVM token balances
Lists the token balances of an EVM address on a given network. The balances include ERC-20 tokens and the native gas token (usually ETH). The response is paginated, and by default, returns 20 balances per page.
Calls to the `base` and `base-sepolia` networks offer:
* 99.5% < 2 second freshness from chain tip for new tokens on an address.
* 99.5% < 2 second freshness from chain tip for balance data.
Calls to the `ethereum` network offer:
* 99% < 30 second freshness from chain tip for new tokens on an address.
* 99% < 2 second freshness from chain tip for balance data.
Sends a `GET` request to `/v2/data/evm/token-balances/{network}/{address}`
Arguments:
- `network`: The human-readable network name to get the balances for.
- `address`: The 0x-prefixed EVM address to get balances for. The address does not need to be checksummed.
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
```ignore
let response = client.list_data_token_balances()
.network(network)
.address(address)
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Sourcepub fn list_tokens_for_account(&self) -> ListTokensForAccount<'_>
pub fn list_tokens_for_account(&self) -> ListTokensForAccount<'_>
List token addresses for account
Retrieve all ERC-20 token contract addresses that an account has ever received tokens from.
Analyzes transaction history to discover token interactions.
Sends a `GET` request to `/v2/data/evm/token-ownership/{network}/{address}`
Arguments:
- `network`: The blockchain network to query.
- `address`: The account address to analyze for token interactions.
```ignore
let response = client.list_tokens_for_account()
.network(network)
.address(address)
.send()
.await;
```Sourcepub fn get_sql_grammar(&self) -> GetSqlGrammar<'_>
pub fn get_sql_grammar(&self) -> GetSqlGrammar<'_>
Get SQL grammar
Retrieve the SQL grammar for the SQL API.
The SQL queries that are supported by the SQL API are defined in ANTLR4 grammar which is evaluated by server before executing the query. This ensures the safety and soundness of the SQL query before execution.
This endpoint returns the ANTLR4 grammar that is used to evaluate the SQL queries so that developers can understand the SQL API and build SQL queries with high confidence and correctness.
LLMs interact well with ANTLR4 grammar. You can feed the grammar directly into the LLMs to help generate SQL queries.
Sends a `GET` request to `/v2/data/query/grammar`
```ignore
let response = client.get_sql_grammar()
.send()
.await;
```Sourcepub fn run_sql_query(&self) -> RunSqlQuery<'_>
pub fn run_sql_query(&self) -> RunSqlQuery<'_>
Run SQL Query
Run a read-only SQL query against indexed blockchain data including transactions, events, and decoded logs.
This endpoint provides direct SQL access to comprehensive blockchain data across supported networks.
Queries are executed against optimized data structures for high-performance analytics.
## Allowed Queries
- Standard SQL syntax (CoinbaSeQL dialect, based on ClickHouse dialect)
- Read-only queries (SELECT statements)
- No DDL or DML operations
- Query that follow limits (defined below)
## Supported Networks
- Base Mainnet: `base`
- Base Sepolia: `base_sepolia`
- Solana Mainnet: `solana`
- Hyperevm Mainnet: `hyperevm`
## Supported Tables
The below tables are supported for `base` and `base_sepolia` networks.
| Table | Description |
| --- | --- |
| `<network>.events` | Decoded event logs with parameters, event signature, topics, and more. |
| `<network>.transactions` | Transaction data including hash, block number, and gas usage. |
| `<network>.blocks` | Block information. |
| `<network>.encoded_logs` | Encoded log data for event logs that cannot be decoded by our event decoder (ex: log0 opcode). |
| `<network>.decoded_user_operations` | Decoded user operations data including hash, block number, gas usage, builder codes, entrypoint version, and more. |
| `<network>.transaction_attributions` | Information about the attributions of a transaction to a builder and associated builder codes. |
Following the above, the valid tables on Base Mainnet are `base.events`, `base.transactions`, `base.blocks`, `base.encoded_logs`, `base.decoded_user_operations`, and `base.transaction_attributions`.
Separately, there is a limited set of tables supported for `solana` and `hyperevm` networks:
| Table | Description |
| --- | --- |
| `solana.instructions` | Solana instruction call data including program ID, instruction data, and more. Currently supports just Token2022 and SPL Token programs. |
| `hyperevm.events` | Hyperevm decoded event logs with parameters, event signature, topics, and more. Currently supports just B20 events. |
## Query Limits
- Maximum result set: 50,000 rows
- Maximum query length: 10,000 characters
- Maximum on-disk data to read: 100GB
- Maximum memory usage: 15GB
- Query timeout: 30 seconds
- Maximum JOINs: 12
## Query Caching
By default, each query result is returned from cache so long as the result is from an identical query and less than 750ms old. This freshness tolerance can be modified upwards, to a maximum of 900000ms (i.e. 900s, 15m).
This can be helpful for users who wish to reduce expensive calls to the SQL API by reusing cached results.
Sends a `POST` request to `/v2/data/query/run`
```ignore
let response = client.run_sql_query()
.body(body)
.send()
.await;
```Sourcepub fn get_sql_schema(&self) -> GetSqlSchema<'_>
pub fn get_sql_schema(&self) -> GetSqlSchema<'_>
Get schema details
Retrieve the schema information for the available tables in the SQL API's indexed data.
This includes table names, column definitions, data types, and indexed fields.
Sends a `GET` request to `/v2/data/query/schema`
Arguments:
- `database`: The name of the database to query. Defaults to "base" when not specified.
- `table`: Get the schema for a specific table.
```ignore
let response = client.get_sql_schema()
.database(database)
.table(table)
.send()
.await;
```Sourcepub fn list_webhook_subscriptions(&self) -> ListWebhookSubscriptions<'_>
pub fn list_webhook_subscriptions(&self) -> ListWebhookSubscriptions<'_>
List webhook subscriptions
Retrieve a paginated list of webhook subscriptions for the authenticated project.
Returns subscriptions for all CDP product events (onchain, onramp/offramp, wallet, etc.)
in descending order by creation time.
## Use Cases
- Monitor all active webhook subscriptions across CDP products
- Audit webhook configurations
- Manage subscription lifecycle
Sends a `GET` request to `/v2/data/webhooks/subscriptions`
Arguments:
- `page_size`: The number of subscriptions to return per page.
- `page_token`: The token for the next page of subscriptions, if any.
```ignore
let response = client.list_webhook_subscriptions()
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Sourcepub fn create_webhook_subscription(&self) -> CreateWebhookSubscription<'_>
pub fn create_webhook_subscription(&self) -> CreateWebhookSubscription<'_>
Create webhook subscription
Subscribe to real-time events across CDP products. A webhook subscription provides a `targetURL` and other relevant endpoint configuration to enable receiving webhooks when events occur.
An entity can have up to 100 webhook subscriptions. Once this limit is reached, new webhook subscription creation requests return a `400` error with `errorType: subscription_limit_exceeded`.
## Webhook Signature Verification
All webhooks include an HMAC-SHA256 signed header for security. The signature is signed with the secret that is returned in the `secret` field when creating a subscription.
Do not lose the secret, as you will not be able to recreate it. If you lose the secret, you will need to create a new subscription.
See the [verification guide](https://docs.cdp.coinbase.com/onramp-&-offramp/webhooks#webhook-signature-verification) for implementation details.
Sends a `POST` request to `/v2/data/webhooks/subscriptions`
```ignore
let response = client.create_webhook_subscription()
.body(body)
.send()
.await;
```Sourcepub fn get_webhook_subscription(&self) -> GetWebhookSubscription<'_>
pub fn get_webhook_subscription(&self) -> GetWebhookSubscription<'_>
Get webhook subscription
Retrieve detailed information about a specific webhook subscription including
configuration, status, creation timestamp, and webhook signature secret.
## Response Includes
- Subscription configuration and filters
- Target URL and custom headers
- Webhook signature secret for verification
- Creation timestamp and status
Sends a `GET` request to `/v2/data/webhooks/subscriptions/{subscriptionId}`
Arguments:
- `subscription_id`: Unique identifier for the webhook subscription.
```ignore
let response = client.get_webhook_subscription()
.subscription_id(subscription_id)
.send()
.await;
```Sourcepub fn update_webhook_subscription(&self) -> UpdateWebhookSubscription<'_>
pub fn update_webhook_subscription(&self) -> UpdateWebhookSubscription<'_>
Update webhook subscription
Update an existing webhook subscription's configuration including
event types, target URL, filtering criteria, and enabled status.
All required fields must be provided, even if they are not being changed.
## Common Updates
- Change target URL or headers
- Add/remove event type filters
- Update multi-label filtering criteria
- Enable/disable subscription
Sends a `PUT` request to `/v2/data/webhooks/subscriptions/{subscriptionId}`
Arguments:
- `subscription_id`: Unique identifier for the webhook subscription.
- `body`
```ignore
let response = client.update_webhook_subscription()
.subscription_id(subscription_id)
.body(body)
.send()
.await;
```Sourcepub fn delete_webhook_subscription(&self) -> DeleteWebhookSubscription<'_>
pub fn delete_webhook_subscription(&self) -> DeleteWebhookSubscription<'_>
Delete webhook subscription
Permanently delete a webhook subscription and stop all event deliveries.
This action cannot be undone.
## Important Notes
- All webhook deliveries will cease immediately
- Subscription cannot be recovered after deletion
- Consider disabling instead of deleting for temporary pauses
Sends a `DELETE` request to `/v2/data/webhooks/subscriptions/{subscriptionId}`
Arguments:
- `subscription_id`: Unique identifier for the webhook subscription.
```ignore
let response = client.delete_webhook_subscription()
.subscription_id(subscription_id)
.send()
.await;
```Sourcepub fn list_webhook_subscription_events(
&self,
) -> ListWebhookSubscriptionEvents<'_>
pub fn list_webhook_subscription_events( &self, ) -> ListWebhookSubscriptionEvents<'_>
List webhook subscription events
Retrieve webhook event delivery attempts for a specific subscription.
Returns event deliveries in descending order by creation time (newest first),
including delivery status, retry count, and response details.
## Use Cases
- Debug webhook delivery failures and inspect response codes
- Monitor delivery status and retry counts
- Audit event delivery history for a subscription
- Verify that expected events were sent to webhook URLs
## Filtering
Use optional query parameters to narrow results:
- `eventId` — find a specific event by ID
- `minCreatedAt` / `maxCreatedAt` — filter by time range
- `eventTypeNames` — filter by event type (comma-separated)
**Note:** Results are limited to the 50 most recent events (newest first). No pagination is supported.
Sends a `GET` request to `/v2/data/webhooks/subscriptions/{subscriptionId}/events`
Arguments:
- `subscription_id`: Unique identifier for the webhook subscription.
- `event_id`: Filter by a specific event ID.
- `event_type_names`: Filter by event type names (comma-separated).
- `max_created_at`: Filter events created at or before this timestamp (RFC 3339 format).
- `min_created_at`: Filter events created at or after this timestamp (RFC 3339 format).
```ignore
let response = client.list_webhook_subscription_events()
.subscription_id(subscription_id)
.event_id(event_id)
.event_type_names(event_type_names)
.max_created_at(max_created_at)
.min_created_at(min_created_at)
.send()
.await;
```Sourcepub fn list_deposit_destinations(&self) -> ListDepositDestinations<'_>
pub fn list_deposit_destinations(&self) -> ListDepositDestinations<'_>
List deposit destinations
List deposit destinations. You can optionally filter the results by type, account ID, network, cryptocurrency address, or status. Results are sorted by creation date in descending order (newest first).
Sends a `GET` request to `/v2/deposit-destinations`
Arguments:
- `account_id`: Filter deposit destinations by account ID.
- `address`: Filter deposit destinations by the cryptocurrency address.
- `network`: Filter deposit destinations by network.
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
- `status`: Filter deposit destinations by status.
- `type_`: Filter deposit destinations by type.
```ignore
let response = client.list_deposit_destinations()
.account_id(account_id)
.address(address)
.network(network)
.page_size(page_size)
.page_token(page_token)
.status(status)
.type_(type_)
.send()
.await;
```Sourcepub fn create_deposit_destination(&self) -> CreateDepositDestination<'_>
pub fn create_deposit_destination(&self) -> CreateDepositDestination<'_>
Create deposit destination
Create a new deposit destination for an account. Two types are supported:
- `crypto` (public): provisions a cryptocurrency address on the requested
network. The returned `crypto.address` is the deposit address; funds
sent to it are credited to the `target` account in the specified asset.
For Customer-owned accounts, the Customer must have the `custodyCrypto`
and `custodyStablecoin` capabilities enabled.
- `fiat` (private-beta): provisions a bank
account at a CDP banking partner. The server picks the account type
(e.g. `us_bank`) and supported payment rails based on the account's
eligibility; pass `fiat.paymentRail` to influence partner selection.
The returned `fiat` object contains the bank account details the
depositor needs to send funds. For Customer-owned accounts, the Customer
must have the `custodyFiat` capability enabled. Requires account
enablement — contact your Coinbase representative for access. Fields
and behavior may change before general availability.
For Customer-owned accounts not authorized for the required capabilities,
the request is rejected with `customer_not_authorized` (HTTP 403).
The created destination's `status` starts as `pending` for fiat (it
becomes `active` once the partner provisioning callback completes) and
`active` for crypto.
Sends a `POST` request to `/v2/deposit-destinations`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.create_deposit_destination()
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn get_deposit_destination_by_id(&self) -> GetDepositDestinationById<'_>
pub fn get_deposit_destination_by_id(&self) -> GetDepositDestinationById<'_>
Get deposit destination
Get a specific deposit destination by its ID.
Sends a `GET` request to `/v2/deposit-destinations/{depositDestinationId}`
Arguments:
- `deposit_destination_id`: The ID of the deposit address to retrieve.
```ignore
let response = client.get_deposit_destination_by_id()
.deposit_destination_id(deposit_destination_id)
.send()
.await;
```Sourcepub fn list_disbursements(&self) -> ListDisbursements<'_>
pub fn list_disbursements(&self) -> ListDisbursements<'_>
List disbursements
Returns a paginated list of disbursements accessible to your API key. Filter by `status`, `sourceAccountId`, or `externalReferenceId`.
Sends a `GET` request to `/v2/disbursements`
Arguments:
- `external_reference_id`: Filter disbursements by the client-supplied external reference ID.
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
- `source_account_id`: Filter disbursements by the source CDP account ID.
- `status`: Filter disbursements by status.
```ignore
let response = client.list_disbursements()
.external_reference_id(external_reference_id)
.page_size(page_size)
.page_token(page_token)
.source_account_id(source_account_id)
.status(status)
.send()
.await;
```Sourcepub fn create_disbursement(&self) -> CreateDisbursement<'_>
pub fn create_disbursement(&self) -> CreateDisbursement<'_>
Create a disbursement
Creates a disbursement from a CDP account you own to a Coinbase user account or an onchain address. Returns the disbursement with `pending` status while processing continues asynchronously.
Sends a `POST` request to `/v2/disbursements`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.create_disbursement()
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn get_disbursement(&self) -> GetDisbursement<'_>
pub fn get_disbursement(&self) -> GetDisbursement<'_>
Get a disbursement
Returns the disbursement identified by `disbursementId`. Your API key must have permission to access the disbursement.
Sends a `GET` request to `/v2/disbursements/{disbursementId}`
Arguments:
- `disbursement_id`: The unique identifier of the disbursement.
```ignore
let response = client.get_disbursement()
.disbursement_id(disbursement_id)
.send()
.await;
```Sourcepub fn get_delegation_for_end_user_account(
&self,
) -> GetDelegationForEndUserAccount<'_>
pub fn get_delegation_for_end_user_account( &self, ) -> GetDelegationForEndUserAccount<'_>
Get account-scoped delegation for end user
Returns the active account-scoped delegation for the specified end user account, if one exists. Useful for showing delegation status in a UI.
When the address corresponds to an EVM Smart Account, this returns the delegation for the Smart Account's owner EOA.
Sends a `GET` request to `/v2/embedded-wallet-api/end-users/{userId}/address/{address}/delegation`
Arguments:
- `user_id`: The ID of the end user.
- `address`: The blockchain address of the end user account to query. For EVM addresses, matching is case-insensitive.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
```ignore
let response = client.get_delegation_for_end_user_account()
.user_id(user_id)
.address(address)
.project_id(project_id)
.send()
.await;
```Sourcepub fn create_delegation_for_end_user_account(
&self,
) -> CreateDelegationForEndUserAccount<'_>
pub fn create_delegation_for_end_user_account( &self, ) -> CreateDelegationForEndUserAccount<'_>
Create account-scoped delegation for end user
Creates an account-scoped delegation that allows a developer to sign on behalf of an end user for a single blockchain account (identified by its address) for the specified duration. The end user must be authenticated to authorize this delegation.
Multiple account-scoped delegations may exist concurrently for a single end user (one per canonical account address). Account-scoped and user-scoped delegations cannot coexist for the same user.
When the address corresponds to an EVM Smart Account, the delegation is scoped to the Smart Account's owner EOA rather than the Smart Account address itself. This means `/address/{smartAccountAddress}/delegation` and `/address/{ownerEoaAddress}/delegation` resolve to the same delegation, and the 409 `account_scoped_delegation_active` error may be returned when creating via either address if one already exists for the canonical owner.
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/address/{address}/delegation`
Arguments:
- `user_id`: The ID of the end user.
- `address`: The blockchain address of the end user account to scope this delegation to. Format varies by network (e.g., 0x-prefixed for EVM, base58 for Solana). For EVM addresses, matching is case-insensitive.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.create_delegation_for_end_user_account()
.user_id(user_id)
.address(address)
.project_id(project_id)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn revoke_delegation_for_end_user_account_deprecated(
&self,
) -> RevokeDelegationForEndUserAccountDeprecated<'_>
pub fn revoke_delegation_for_end_user_account_deprecated( &self, ) -> RevokeDelegationForEndUserAccountDeprecated<'_>
Revoke account-scoped delegation for end user (deprecated)
> **Deprecation Notice:** Prefer
> [Revoke account-scoped delegation for end user](#operation/revokeDelegationForEndUserAccount)
> (`POST /v2/embedded-wallet-api/end-users/{userId}/address/{address}/delegation/revoke`),
> which takes the same request body. This `DELETE` path will be removed on **2026-10-22**.
Revokes the active account-scoped delegation for the specified end user account.
Other account-scoped delegations for the same user are unaffected. This operation
can be performed by the end user themselves or by a developer using their API key.
When the address corresponds to an EVM Smart Account, this revokes the delegation for the
Smart Account's owner EOA.
Sends a `DELETE` request to `/v2/embedded-wallet-api/end-users/{userId}/address/{address}/delegation`
Arguments:
- `user_id`: The ID of the end user.
- `address`: The blockchain address of the end user account whose delegation should be revoked. For EVM addresses, matching is case-insensitive.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_developer_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.revoke_delegation_for_end_user_account_deprecated()
.user_id(user_id)
.address(address)
.project_id(project_id)
.x_developer_auth(x_developer_auth)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn revoke_delegation_for_end_user_account(
&self,
) -> RevokeDelegationForEndUserAccount<'_>
pub fn revoke_delegation_for_end_user_account( &self, ) -> RevokeDelegationForEndUserAccount<'_>
Revoke account-scoped delegation for end user
Revokes the active account-scoped delegation for the specified end user account. Other account-scoped delegations for the same user are unaffected. This operation can be performed by the end user themselves or by a developer using their API key.
When the address corresponds to an EVM Smart Account, this revokes the delegation for the Smart Account's owner EOA.
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/address/{address}/delegation/revoke`
Arguments:
- `user_id`: The ID of the end user.
- `address`: The blockchain address of the end user account whose delegation should be revoked. For EVM addresses, matching is case-insensitive.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_developer_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.revoke_delegation_for_end_user_account()
.user_id(user_id)
.address(address)
.project_id(project_id)
.x_developer_auth(x_developer_auth)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn get_delegation_for_end_user(&self) -> GetDelegationForEndUser<'_>
pub fn get_delegation_for_end_user(&self) -> GetDelegationForEndUser<'_>
Get delegation for end user
Returns the active delegation for the specified end user, if one exists. This operation can be performed by the end user themselves or by a developer using their API key.
Sends a `GET` request to `/v2/embedded-wallet-api/end-users/{userId}/delegation`
Arguments:
- `user_id`: The ID of the end user.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
```ignore
let response = client.get_delegation_for_end_user()
.user_id(user_id)
.project_id(project_id)
.send()
.await;
```Sourcepub fn revoke_delegation_for_end_user_deprecated(
&self,
) -> RevokeDelegationForEndUserDeprecated<'_>
pub fn revoke_delegation_for_end_user_deprecated( &self, ) -> RevokeDelegationForEndUserDeprecated<'_>
Revoke delegation for end user (deprecated)
> **Deprecation Notice:** Prefer
> [Revoke delegation for end user](#operation/revokeDelegationForEndUser)
> (`POST /v2/embedded-wallet-api/end-users/{userId}/delegation/revoke`), which takes the
> same request body. This `DELETE` path will be removed on **2026-10-22**.
Revokes all active delegations for the specified end user. This operation
can be performed by the end user themselves or by a developer using their
API key.
Sends a `DELETE` request to `/v2/embedded-wallet-api/end-users/{userId}/delegation`
Arguments:
- `user_id`: The ID of the end user.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_developer_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.revoke_delegation_for_end_user_deprecated()
.user_id(user_id)
.project_id(project_id)
.x_developer_auth(x_developer_auth)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn revoke_delegation_for_end_user(&self) -> RevokeDelegationForEndUser<'_>
pub fn revoke_delegation_for_end_user(&self) -> RevokeDelegationForEndUser<'_>
Revoke delegation for end user
Revokes all active delegations for the specified end user. This operation can be performed by the end user themselves or by a developer using their API key.
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/delegation/revoke`
Arguments:
- `user_id`: The ID of the end user.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_developer_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.revoke_delegation_for_end_user()
.user_id(user_id)
.project_id(project_id)
.x_developer_auth(x_developer_auth)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn create_evm_eip7702_delegation_with_end_user_account(
&self,
) -> CreateEvmEip7702DelegationWithEndUserAccount<'_>
pub fn create_evm_eip7702_delegation_with_end_user_account( &self, ) -> CreateEvmEip7702DelegationWithEndUserAccount<'_>
Create EIP-7702 delegation for end user EVM account
Creates an EIP-7702 delegation for an end user's EVM EOA account, upgrading it with smart account capabilities.
This endpoint:
- Retrieves delegation artifacts from onchain
- Signs the EIP-7702 authorization for delegation
- Assembles and submits a Type 4 transaction
- Creates an associated smart account object
The delegation allows the EVM EOA to be used as a smart account, which enables batched transactions and gas sponsorship via paymaster.
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/evm/eip7702/delegation`
Arguments:
- `user_id`: The ID of the end user.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_developer_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.create_evm_eip7702_delegation_with_end_user_account()
.user_id(user_id)
.project_id(project_id)
.x_developer_auth(x_developer_auth)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn send_evm_transaction_with_end_user_account(
&self,
) -> SendEvmTransactionWithEndUserAccount<'_>
pub fn send_evm_transaction_with_end_user_account( &self, ) -> SendEvmTransactionWithEndUserAccount<'_>
Send transaction via end user EVM account
Signs a transaction with the given end user EVM account and sends it to the indicated supported network. This API handles nonce management and gas estimation, leaving the developer to provide only the minimal set of fields necessary to send the transaction. The transaction should be serialized as a hex string using [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/).
The transaction must be an [EIP-1559 dynamic fee transaction](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md).
**Transaction fields and API behavior**
- `to` *(Required)*: The address of the contract or account to send the transaction to.
- `chainId` *(Ignored)*: The value of the `chainId` field in the transaction is ignored.
The transaction will be sent to the network indicated by the `network` field in the request body.
- `nonce` *(Optional)*: The nonce to use for the transaction. If not provided, the API will assign
a nonce to the transaction based on the current state of the account.
- `maxPriorityFeePerGas` *(Optional)*: The maximum priority fee per gas to use for the transaction.
If not provided, the API will estimate a value based on current network conditions.
- `maxFeePerGas` *(Optional)*: The maximum fee per gas to use for the transaction.
If not provided, the API will estimate a value based on current network conditions.
- `gasLimit` *(Optional)*: The gas limit to use for the transaction. If not provided, the API will estimate a value
based on the `to` and `data` fields of the transaction.
- `value` *(Optional)*: The amount of ETH, in wei, to send with the transaction.
- `data` *(Optional)*: The data to send with the transaction; only used for contract calls.
- `accessList` *(Optional)*: The access list to use for the transaction.
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/evm/send/transaction`
Arguments:
- `user_id`: The ID of the end user.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_developer_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.send_evm_transaction_with_end_user_account()
.user_id(user_id)
.project_id(project_id)
.x_developer_auth(x_developer_auth)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn sign_evm_message_with_end_user_account(
&self,
) -> SignEvmMessageWithEndUserAccount<'_>
pub fn sign_evm_message_with_end_user_account( &self, ) -> SignEvmMessageWithEndUserAccount<'_>
Sign EIP-191 message via end user EVM account
Signs an [EIP-191](https://eips.ethereum.org/EIPS/eip-191) message with the given end user EVM account.
Per the specification, the message in the request body is prepended with `0x19 <0x45 (E)> <thereum Signed Message:\n" + len(message)>` before being signed.
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/evm/sign/message`
Arguments:
- `user_id`: The ID of the end user.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_developer_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_evm_message_with_end_user_account()
.user_id(user_id)
.project_id(project_id)
.x_developer_auth(x_developer_auth)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn sign_evm_transaction_with_end_user_account(
&self,
) -> SignEvmTransactionWithEndUserAccount<'_>
pub fn sign_evm_transaction_with_end_user_account( &self, ) -> SignEvmTransactionWithEndUserAccount<'_>
Sign transaction via end user EVM account
Signs a transaction with the given end user EVM account.
The transaction should be serialized as a hex string using [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/).
The transaction must be an [EIP-1559 dynamic fee transaction](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md). The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/evm/sign/transaction`
Arguments:
- `user_id`: The ID of the end user.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_developer_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_evm_transaction_with_end_user_account()
.user_id(user_id)
.project_id(project_id)
.x_developer_auth(x_developer_auth)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn sign_evm_typed_data_with_end_user_account(
&self,
) -> SignEvmTypedDataWithEndUserAccount<'_>
pub fn sign_evm_typed_data_with_end_user_account( &self, ) -> SignEvmTypedDataWithEndUserAccount<'_>
Sign EIP-712 typed data via end user EVM account
Signs [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed data with the given end user EVM account.
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/evm/sign/typed-data`
Arguments:
- `user_id`: The ID of the end user.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_developer_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_evm_typed_data_with_end_user_account()
.user_id(user_id)
.project_id(project_id)
.x_developer_auth(x_developer_auth)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn list_borrow_positions_with_end_user_account(
&self,
) -> ListBorrowPositionsWithEndUserAccount<'_>
pub fn list_borrow_positions_with_end_user_account( &self, ) -> ListBorrowPositionsWithEndUserAccount<'_>
List borrow positions for an end user smart account
Lists the borrow positions held by an end user smart account, with the live onchain state of each position read at a point-in-time snapshot.
A borrow position represents collateral posted and a loan borrowed against it in a borrow product, such as a Morpho Blue market that lends USDC against cbBTC. Each position reports its current collateral and debt balances, its health factor, and its health status. Returns an empty list if the smart account has no borrow positions.
Sends a `GET` request to `/v2/embedded-wallet-api/end-users/{userId}/evm/smart-accounts/{address}/borrow-positions`
Arguments:
- `user_id`: The ID of the end user.
- `address`: The address of the EVM Smart Account to list borrow positions for.
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
```ignore
let response = client.list_borrow_positions_with_end_user_account()
.user_id(user_id)
.address(address)
.page_size(page_size)
.page_token(page_token)
.project_id(project_id)
.send()
.await;
```Sourcepub fn create_borrow_position_with_end_user_account(
&self,
) -> CreateBorrowPositionWithEndUserAccount<'_>
pub fn create_borrow_position_with_end_user_account( &self, ) -> CreateBorrowPositionWithEndUserAccount<'_>
Create a borrow position for an end user smart account
Creates a borrow position for a specific borrow product, by posting collateral from an end user smart account and borrowing a loan against it. One position can be opened per borrow product for a given smart account.
A borrow product is a protocol-native representation of a borrowable market, such as a Morpho Blue market that lends USDC against cbBTC. The `borrowProductId` identifies the product to borrow against, and the `collateralAmount` and `loanAmount` specify the collateral to post and the loan to take, both expressed as decimal strings in standard unit denomination of their respective tokens.
A user operation is broadcast to open the position onchain. Poll `getUserOperationWithEndUserAccount` with the returned `userOpHash` until it reaches a terminal state. Once the user operation succeeds onchain, use the borrow positions list endpoint to view the user's active positions.
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/evm/smart-accounts/{address}/borrow-positions`
Arguments:
- `user_id`: The ID of the end user.
- `address`: The address of the EVM Smart Account to open the borrow position from.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.create_borrow_position_with_end_user_account()
.user_id(user_id)
.address(address)
.project_id(project_id)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn adjust_borrow_position_with_end_user_account(
&self,
) -> AdjustBorrowPositionWithEndUserAccount<'_>
pub fn adjust_borrow_position_with_end_user_account( &self, ) -> AdjustBorrowPositionWithEndUserAccount<'_>
Adjust a borrow position for an end user smart account
Adjusts an existing borrow position for a specific borrow product by supplying collateral, withdrawing collateral, repaying debt, and/or borrowing more of the loan asset from an end user smart account.
The `borrowProductId` identifies the product whose position to adjust, and the `addCollateralAmount`, `removeCollateralAmount`, `repayLoanAmount`, and `borrowLoanAmount` fields specify the changes to apply, each expressed as a decimal string in standard unit denomination of the respective token.
A single request must not combine `addCollateralAmount` with `removeCollateralAmount` or `repayLoanAmount`, and must not combine `borrowLoanAmount` with `repayLoanAmount` or `removeCollateralAmount`. Otherwise any subset of the four amount fields may be supplied; at least one is required.
A user operation is broadcast to adjust the position onchain. Poll `getUserOperationWithEndUserAccount` with the returned `userOpHash` until it reaches a terminal state. Once the user operation succeeds onchain, use the borrow positions list endpoint to view the user's adjusted positions.
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/evm/smart-accounts/{address}/borrow-positions/adjust`
Arguments:
- `user_id`: The ID of the end user.
- `address`: The address of the EVM Smart Account to adjust the borrow position for.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.adjust_borrow_position_with_end_user_account()
.user_id(user_id)
.address(address)
.project_id(project_id)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn close_borrow_position_with_end_user_account(
&self,
) -> CloseBorrowPositionWithEndUserAccount<'_>
pub fn close_borrow_position_with_end_user_account( &self, ) -> CloseBorrowPositionWithEndUserAccount<'_>
Close a borrow position for an end user smart account
Closes an end user smart account's borrow position by fully repaying its outstanding loan and withdrawing all remaining collateral back to the smart account, in a single user operation.
A borrow position is identified by the smart account `address` and the `borrowProductId` in the request body, since a smart account holds at most one position per borrow product. Closing repays the entire accrued debt and withdraws the full collateral balance; there is no partial close. To adjust a position without closing it, use `adjustBorrowPositionWithEndUserAccount` instead.
A user operation is broadcast to close the position onchain. Poll `getUserOperationWithEndUserAccount` with the returned `userOpHash` until it reaches a terminal state. Once the user operation succeeds onchain, the position is closed and no longer appears in the borrow positions list.
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/evm/smart-accounts/{address}/borrow-positions/close`
Arguments:
- `user_id`: The ID of the end user.
- `address`: The address of the EVM Smart Account that holds the borrow position.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.close_borrow_position_with_end_user_account()
.user_id(user_id)
.address(address)
.project_id(project_id)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn send_user_operation_with_end_user_account(
&self,
) -> SendUserOperationWithEndUserAccount<'_>
pub fn send_user_operation_with_end_user_account( &self, ) -> SendUserOperationWithEndUserAccount<'_>
Send user operation for end user Smart Account
Prepares, signs, and sends a user operation for an end user's Smart Account.
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/evm/smart-accounts/{address}/send`
Arguments:
- `user_id`: The ID of the end user.
- `address`: The address of the EVM Smart Account to execute the user operation from.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_developer_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.send_user_operation_with_end_user_account()
.user_id(user_id)
.address(address)
.project_id(project_id)
.x_developer_auth(x_developer_auth)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn get_user_operation_with_end_user_account(
&self,
) -> GetUserOperationWithEndUserAccount<'_>
pub fn get_user_operation_with_end_user_account( &self, ) -> GetUserOperationWithEndUserAccount<'_>
Get a user operation for end user EVM Smart Account
Gets a user operation by its hash for an end user's EVM Smart Account.
Sends a `GET` request to `/v2/embedded-wallet-api/end-users/{userId}/evm/smart-accounts/{address}/user-operations/{userOpHash}`
Arguments:
- `user_id`: The ID of the end user.
- `address`: The address of the Smart Account the user operation belongs to.
- `user_op_hash`: The hash of the user operation to fetch.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
```ignore
let response = client.get_user_operation_with_end_user_account()
.user_id(user_id)
.address(address)
.user_op_hash(user_op_hash)
.project_id(project_id)
.send()
.await;
```Sourcepub fn send_evm_asset_with_end_user_account(
&self,
) -> SendEvmAssetWithEndUserAccount<'_>
pub fn send_evm_asset_with_end_user_account( &self, ) -> SendEvmAssetWithEndUserAccount<'_>
Send USDC on EVM
Sends USDC from an end user's EVM account (EOA or Smart Account) to a recipient address on a supported EVM network. This endpoint simplifies USDC transfers by automatically handling contract resolution, decimal conversion, gas estimation, and transaction encoding.
The `amount` field accepts human-readable amounts as decimal strings (e.g., "1.5", "25.50").
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/evm/{address}/send/{asset}`
Arguments:
- `user_id`: The ID of the end user.
- `address`: The 0x-prefixed address of the EVM account (EOA or Smart Account) to send USDC from. The address does not need to be checksummed.
- `asset`: The asset to send. Currently only "usdc" is supported.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_developer_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.send_evm_asset_with_end_user_account()
.user_id(user_id)
.address(address)
.asset(asset)
.project_id(project_id)
.x_developer_auth(x_developer_auth)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn send_solana_transaction_with_end_user_account(
&self,
) -> SendSolanaTransactionWithEndUserAccount<'_>
pub fn send_solana_transaction_with_end_user_account( &self, ) -> SendSolanaTransactionWithEndUserAccount<'_>
Send transaction via end user Solana account
Signs a transaction with the given end user Solana account and sends it to the indicated supported network.
The API handles recent blockhash management and fee estimation, leaving the developer to provide only the minimal set of fields necessary to send the transaction.
The unsigned transaction should be serialized into a byte array and then encoded as base64.
**Transaction types**
The following transaction types are supported:
* [Legacy transactions](https://solana.com/developers/guides/advanced/versions#current-transaction-versions)
* [Versioned transactions](https://solana.com/developers/guides/advanced/versions)
**Instruction Batching**
To batch multiple operations, include multiple instructions within a single transaction. All instructions within a transaction are executed atomically - if any instruction fails, the entire transaction fails and is rolled back.
**Network Support**
The following Solana networks are supported:
* `solana` - Solana Mainnet
* `solana-devnet` - Solana Devnet
The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/solana/send/transaction`
Arguments:
- `user_id`: The ID of the end user.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_developer_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.send_solana_transaction_with_end_user_account()
.user_id(user_id)
.project_id(project_id)
.x_developer_auth(x_developer_auth)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn sign_solana_message_with_end_user_account(
&self,
) -> SignSolanaMessageWithEndUserAccount<'_>
pub fn sign_solana_message_with_end_user_account( &self, ) -> SignSolanaMessageWithEndUserAccount<'_>
Sign Base64-encoded message
Signs an arbitrary Base64 encoded message with the given Solana account.
**WARNING:** Never sign a message that you didn't generate as it may put your funds at risk.
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/solana/sign/message`
Arguments:
- `user_id`: The ID of the end user.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_developer_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_solana_message_with_end_user_account()
.user_id(user_id)
.project_id(project_id)
.x_developer_auth(x_developer_auth)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn sign_solana_transaction_with_end_user_account(
&self,
) -> SignSolanaTransactionWithEndUserAccount<'_>
pub fn sign_solana_transaction_with_end_user_account( &self, ) -> SignSolanaTransactionWithEndUserAccount<'_>
Sign transaction via end user Solana account
Signs a transaction with the given end user Solana account.
The unsigned transaction should be serialized into a byte array and then encoded as base64.
**Transaction types**
The following transaction types are supported:
* [Legacy transactions](https://solana-labs.github.io/solana-web3.js/classes/Transaction.html)
* [Versioned transactions](https://solana-labs.github.io/solana-web3.js/classes/VersionedTransaction.html)
The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/solana/sign/transaction`
Arguments:
- `user_id`: The ID of the end user.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_developer_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_solana_transaction_with_end_user_account()
.user_id(user_id)
.project_id(project_id)
.x_developer_auth(x_developer_auth)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn sign_solana_x402_payment_with_end_user_account(
&self,
) -> SignSolanaX402PaymentWithEndUserAccount<'_>
pub fn sign_solana_x402_payment_with_end_user_account( &self, ) -> SignSolanaX402PaymentWithEndUserAccount<'_>
Sign x402 payment via end user Solana account
Signs an x402 payment payload using the end user's given Solana account.
Accepts the full x402 payment required response body from a resource server plus an index into the accepts array selecting which payment option to sign. The paymentRequired envelope's x402Version, resource, and extensions are carried through into the signed payment payload; only the selected accept entry becomes paymentPayload.accepted.
Returns a signed payment payload that can be base64-encoded and sent in the PAYMENT-SIGNATURE header of the resource request.
If acceptsIndex is out of range for paymentRequired.accepts, or the selected accept is not a Solana network payment option, the request fails with 422.
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/solana/sign/x402-payment`
Arguments:
- `user_id`: The ID of the end user.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_developer_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_solana_x402_payment_with_end_user_account()
.user_id(user_id)
.project_id(project_id)
.x_developer_auth(x_developer_auth)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn send_solana_asset_with_end_user_account(
&self,
) -> SendSolanaAssetWithEndUserAccount<'_>
pub fn send_solana_asset_with_end_user_account( &self, ) -> SendSolanaAssetWithEndUserAccount<'_>
Send USDC on Solana
Sends USDC from an end user's Solana account to a recipient address on the Solana network. This endpoint simplifies USDC transfers by automatically handling mint resolution, Associated Token Account (ATA) creation, decimal conversion, and transaction encoding.
The `amount` field accepts human-readable amounts as decimal strings (e.g., "1.5", "25.50").
Use the optional `createRecipientAta` parameter to control whether the sender pays for creating the recipient's Associated Token Account if it doesn't exist.
Sends a `POST` request to `/v2/embedded-wallet-api/end-users/{userId}/solana/{address}/send/{asset}`
Arguments:
- `user_id`: The ID of the end user.
- `address`: The base58 encoded address of the Solana account to send USDC from.
- `asset`: The asset to send. Currently only "usdc" is supported.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `x_developer_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.send_solana_asset_with_end_user_account()
.user_id(user_id)
.address(address)
.asset(asset)
.project_id(project_id)
.x_developer_auth(x_developer_auth)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn list_evm_borrow_products(&self) -> ListEvmBorrowProducts<'_>
pub fn list_evm_borrow_products(&self) -> ListEvmBorrowProducts<'_>
List borrow products
Lists the borrow products available across all supported networks and protocols. If a network and/or protocol query parameter is supplied, then borrow products are filtered and returned accordingly.
A borrow product is a protocol-native representation of a borrowable market, describing the venue that hosts it, the assets that can be borrowed or posted as collateral, and their collateral and debt capabilities. For example, a Morpho Blue market that lends USDC against cbBTC.
Sends a `GET` request to `/v2/embedded-wallet-api/evm/borrow-products`
Arguments:
- `network`: The EVM network name to list borrow products for.
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
- `protocol`: The lending protocol whose borrow products to list.
```ignore
let response = client.list_evm_borrow_products()
.network(network)
.page_size(page_size)
.page_token(page_token)
.project_id(project_id)
.protocol(protocol)
.send()
.await;
```Sourcepub fn get_evm_borrow_product(&self) -> GetEvmBorrowProduct<'_>
pub fn get_evm_borrow_product(&self) -> GetEvmBorrowProduct<'_>
Get a borrow product
Gets a single borrow product by its ID.
The ID is a stable identifier that uniquely identifies a single borrow product based on the product's onchain parameters. A borrow product is a protocol-native representation of a borrowable market, describing the venue that hosts it and the assets that participate in it together with their collateral and debt capabilities.
Sends a `GET` request to `/v2/embedded-wallet-api/evm/borrow-products/{borrowProductId}`
Arguments:
- `borrow_product_id`: The globally unique ID of the borrow product.
- `project_id`: The ID of the CDP Project. Required for end users authenticated using custom auth (i.e. a non-CDP JWT provider).
```ignore
let response = client.get_evm_borrow_product()
.borrow_product_id(borrow_product_id)
.project_id(project_id)
.send()
.await;
```Sourcepub fn list_end_users(&self) -> ListEndUsers<'_>
pub fn list_end_users(&self) -> ListEndUsers<'_>
List end users
Lists the end users belonging to the developer's CDP Project.
By default, the response is sorted by creation date in ascending order and paginated to 20 users per page.
Sends a `GET` request to `/v2/end-users`
Arguments:
- `page_size`: The number of end users to return per page.
- `page_token`: The token for the desired page of end users. Will be empty if there are no more end users to fetch.
- `sort`: Sort end users. Defaults to ascending order (oldest first).
```ignore
let response = client.list_end_users()
.page_size(page_size)
.page_token(page_token)
.sort(sort)
.send()
.await;
```Sourcepub fn create_end_user(&self) -> CreateEndUser<'_>
pub fn create_end_user(&self) -> CreateEndUser<'_>
Create end user
Creates an end user. An end user is an entity that can own CDP EVM accounts, EVM smart accounts, and/or Solana accounts. 1 or more authentication methods must be associated with an end user. By default, no accounts are created unless the optional `evmAccount` and/or `solanaAccount` fields are provided.
This API is intended to be used by the developer's own backend, and is authenticated using the developer's CDP API key.
Sends a `POST` request to `/v2/end-users`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.create_end_user()
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn validate_end_user_access_token(&self) -> ValidateEndUserAccessToken<'_>
pub fn validate_end_user_access_token(&self) -> ValidateEndUserAccessToken<'_>
Validate end user access token
Validates the end user's access token and returns the end user's information. Returns an error if the access token is invalid or expired.
This API is intended to be used by the developer's own backend, and is authenticated using the developer's CDP API key.
Sends a `POST` request to `/v2/end-users/auth/validate-token`
```ignore
let response = client.validate_end_user_access_token()
.body(body)
.send()
.await;
```Sourcepub fn import_end_user(&self) -> ImportEndUser<'_>
pub fn import_end_user(&self) -> ImportEndUser<'_>
Import end user private key
Imports an existing private key for an end user into the developer's CDP Project. The private key must be encrypted using the CDP SDK's encryption scheme before being sent to this endpoint. This API should be called from the [CDP SDK](https://github.com/coinbase/cdp-sdk) to ensure that the associated private key is properly encrypted.
This endpoint allows developers to import existing keys for their end users, supporting both EVM and Solana key types. The end user must have at least one authentication method configured.
Sends a `POST` request to `/v2/end-users/import`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.import_end_user()
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn lookup_end_user(&self) -> LookupEndUser<'_>
pub fn lookup_end_user(&self) -> LookupEndUser<'_>
Look up end users by identity
Looks up end users. Exactly one lookup type must be provided per request:
- **email**: searches across all email-based authentication methods
(email, Google, Apple, GitHub). May return multiple end users if the
same email address appears across different auth methods.
- **oauthProvider + oauthSubject**: looks up a user by their OAuth
provider and subject (the `sub` claim from the provider's ID token).
Both params must be provided together.
- **phoneNumber**: looks up a user by their SMS-verified phone number.
- **siweAddress**: looks up a user by the Ethereum address they authenticated
with via Sign In With Ethereum (EIP-4361).
Returns all matching end users. If no end users match, an empty array is returned.
This API is intended to be used by the developer's own backend, and is authenticated using the developer's CDP API key.
Sends a `GET` request to `/v2/end-users/lookup`
Arguments:
- `email`: The email address to search for across all email-based authentication methods.
- `oauth_provider`: The OAuth provider to search by. Must be provided together with oauthSubject.
- `oauth_subject`: The OAuth subject (the `sub` claim from the provider's ID token). Must be provided together with oauthProvider.
- `phone_number`: The E.164-formatted phone number to search for. Must be URL-encoded when passed as a query parameter (e.g. `+14155552671` → `%2B14155552671`).
- `siwe_address`: The ERC-55 checksummed Ethereum address to search for. Looks up a user by the address they authenticated with via Sign In With Ethereum (EIP-4361).
```ignore
let response = client.lookup_end_user()
.email(email)
.oauth_provider(oauth_provider)
.oauth_subject(oauth_subject)
.phone_number(phone_number)
.siwe_address(siwe_address)
.send()
.await;
```Sourcepub fn get_end_user(&self) -> GetEndUser<'_>
pub fn get_end_user(&self) -> GetEndUser<'_>
Get end user
Gets an end user by ID.
This API is intended to be used by the developer's own backend, and is authenticated using the developer's CDP API key.
Sends a `GET` request to `/v2/end-users/{userId}`
Arguments:
- `user_id`: The ID of the end user to get.
```ignore
let response = client.get_end_user()
.user_id(user_id)
.send()
.await;
```Sourcepub fn add_end_user_evm_account(&self) -> AddEndUserEvmAccount<'_>
pub fn add_end_user_evm_account(&self) -> AddEndUserEvmAccount<'_>
Add EVM account to end user
Adds a new EVM EOA account to an existing end user. End users can have up to 10 EVM accounts.
This API is intended to be used by the developer's own backend, and is authenticated using the developer's CDP API key.
Sends a `POST` request to `/v2/end-users/{userId}/evm`
Arguments:
- `user_id`: The ID of the end user to add the account to.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.add_end_user_evm_account()
.user_id(user_id)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn add_end_user_evm_smart_account(&self) -> AddEndUserEvmSmartAccount<'_>
pub fn add_end_user_evm_smart_account(&self) -> AddEndUserEvmSmartAccount<'_>
Add EVM smart account to end user
Creates an EVM smart account for an existing end user. The backend will create a new EVM EOA account to serve as the owner of the smart account.
This API is intended to be used by the developer's own backend, and is authenticated using the developer's CDP API key.
Sends a `POST` request to `/v2/end-users/{userId}/evm-smart-account`
Arguments:
- `user_id`: The ID of the end user to add the smart account to.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.add_end_user_evm_smart_account()
.user_id(user_id)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn add_end_user_solana_account(&self) -> AddEndUserSolanaAccount<'_>
pub fn add_end_user_solana_account(&self) -> AddEndUserSolanaAccount<'_>
Add Solana account to end user
Adds a new Solana account to an existing end user. End users can have up to 10 Solana accounts.
This API is intended to be used by the developer's own backend, and is authenticated using the developer's CDP API key.
Sends a `POST` request to `/v2/end-users/{userId}/solana`
Arguments:
- `user_id`: The ID of the end user to add the account to.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.add_end_user_solana_account()
.user_id(user_id)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn list_evm_accounts(&self) -> ListEvmAccounts<'_>
pub fn list_evm_accounts(&self) -> ListEvmAccounts<'_>
List EVM accounts
Lists the EVM accounts belonging to the developer's CDP Project.
The response is paginated, and by default, returns 20 accounts per page.
Sends a `GET` request to `/v2/evm/accounts`
Arguments:
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
```ignore
let response = client.list_evm_accounts()
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Sourcepub fn create_evm_account(&self) -> CreateEvmAccount<'_>
pub fn create_evm_account(&self) -> CreateEvmAccount<'_>
Create EVM account
Creates a new EVM account.
Sends a `POST` request to `/v2/evm/accounts`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.create_evm_account()
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn get_evm_account_by_name(&self) -> GetEvmAccountByName<'_>
pub fn get_evm_account_by_name(&self) -> GetEvmAccountByName<'_>
Get EVM account by name
Gets an EVM account by its name.
Sends a `GET` request to `/v2/evm/accounts/by-name/{name}`
Arguments:
- `name`: The name of the EVM account.
```ignore
let response = client.get_evm_account_by_name()
.name(name)
.send()
.await;
```Sourcepub fn export_evm_account_by_name(&self) -> ExportEvmAccountByName<'_>
pub fn export_evm_account_by_name(&self) -> ExportEvmAccountByName<'_>
Export EVM account by name
Export an existing EVM account's private key by its name. It is important to store the private key in a secure place after it's exported.
Sends a `POST` request to `/v2/evm/accounts/export/by-name/{name}`
Arguments:
- `name`: The name of the EVM account.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.export_evm_account_by_name()
.name(name)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn import_evm_account(&self) -> ImportEvmAccount<'_>
pub fn import_evm_account(&self) -> ImportEvmAccount<'_>
Import EVM account
Import an existing EVM account into the developer's CDP Project. This API should be called from the [CDP SDK](https://github.com/coinbase/cdp-sdk) to ensure that the associated private key is properly encrypted.
Sends a `POST` request to `/v2/evm/accounts/import`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.import_evm_account()
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn get_evm_account(&self) -> GetEvmAccount<'_>
pub fn get_evm_account(&self) -> GetEvmAccount<'_>
Get EVM account by address
Gets an EVM account by its address.
Sends a `GET` request to `/v2/evm/accounts/{address}`
Arguments:
- `address`: The 0x-prefixed address of the EVM account. The address does not need to be checksummed.
```ignore
let response = client.get_evm_account()
.address(address)
.send()
.await;
```Sourcepub fn update_evm_account(&self) -> UpdateEvmAccount<'_>
pub fn update_evm_account(&self) -> UpdateEvmAccount<'_>
Update EVM account
Updates an existing EVM account. Use this to update the account's name or account-level policy.
Sends a `PUT` request to `/v2/evm/accounts/{address}`
Arguments:
- `address`: The 0x-prefixed address of the EVM account. The address does not need to be checksummed.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.update_evm_account()
.address(address)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn create_evm_eip7702_delegation(&self) -> CreateEvmEip7702Delegation<'_>
pub fn create_evm_eip7702_delegation(&self) -> CreateEvmEip7702Delegation<'_>
Create EIP-7702 delegation
Creates an EIP-7702 delegation for an EVM EOA account, upgrading it with smart account capabilities.
This endpoint:
- Retrieves delegation artifacts from onchain
- Signs the EIP-7702 authorization for delegation
- Assembles and submits a Type 4 transaction
- Creates an associated smart account object
The delegation allows the EVM EOA to be used as a smart account, which enables batched transactions and gas sponsorship via paymaster.
Sends a `POST` request to `/v2/evm/accounts/{address}/eip7702/delegation`
Arguments:
- `address`: The 0x-prefixed address of the EVM account to delegate.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.create_evm_eip7702_delegation()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn export_evm_account(&self) -> ExportEvmAccount<'_>
pub fn export_evm_account(&self) -> ExportEvmAccount<'_>
Export EVM account
Export an existing EVM account's private key. It is important to store the private key in a secure place after it's exported.
Sends a `POST` request to `/v2/evm/accounts/{address}/export`
Arguments:
- `address`: The 0x-prefixed address of the EVM account. The address does not need to be checksummed.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.export_evm_account()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn redeem_vault_fees_with_evm_account(
&self,
) -> RedeemVaultFeesWithEvmAccount<'_>
pub fn redeem_vault_fees_with_evm_account( &self, ) -> RedeemVaultFeesWithEvmAccount<'_>
Redeem vault fees with an EVM account
Redeems every vault share held by the vault's fee recipient EVM account for the vault's underlying asset (e.g. USDC). The account must be the vault's fee recipient.
CDP periodically distributes each vault's accrued fees to its fee recipient as vault shares. This API redeems the account's full share balance, including any shares from the account's own deposits into the vault, so use a dedicated fee recipient account.
The account signs an EIP-2612 permit over its vault shares, and the share approval and redemption are executed in a single transaction.
For fee recipients that are EVM Smart Accounts, use `redeemVaultFeesWithEvmSmartAccount` instead.
Sends a `POST` request to `/v2/evm/accounts/{address}/lend/redeem-fees`
Arguments:
- `address`: The 0x-prefixed address of the EVM account that is the vault's fee recipient.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.redeem_vault_fees_with_evm_account()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn send_evm_transaction(&self) -> SendEvmTransaction<'_>
pub fn send_evm_transaction(&self) -> SendEvmTransaction<'_>
Send transaction
Signs a transaction with the given EVM account and sends it to the indicated supported network. This API handles nonce management and gas estimation, leaving the developer to provide only the minimal set of fields necessary to send the transaction. The transaction should be serialized as a hex string using [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/).
The transaction must be an [EIP-1559 dynamic fee transaction](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md).
**Transaction fields and API behavior**
- `to` *(Required)*: The address of the contract or account to send the transaction to.
- `chainId` *(Ignored)*: The value of the `chainId` field in the transaction is ignored.
The transaction will be sent to the network indicated by the `network` field in the request body.
- `nonce` *(Optional)*: The nonce to use for the transaction. If not provided, the API will assign
a nonce to the transaction based on the current state of the account.
- `maxPriorityFeePerGas` *(Optional)*: The maximum priority fee per gas to use for the transaction.
If not provided, the API will estimate a value based on current network conditions.
- `maxFeePerGas` *(Optional)*: The maximum fee per gas to use for the transaction.
If not provided, the API will estimate a value based on current network conditions.
- `gasLimit` *(Optional)*: The gas limit to use for the transaction. If not provided, the API will estimate a value
based on the `to` and `data` fields of the transaction.
- `value` *(Optional)*: The amount of ETH, in wei, to send with the transaction.
- `data` *(Optional)*: The data to send with the transaction; only used for contract calls.
- `accessList` *(Optional)*: The access list to use for the transaction.
Sends a `POST` request to `/v2/evm/accounts/{address}/send/transaction`
Arguments:
- `address`: The 0x-prefixed address of the Ethereum account.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.send_evm_transaction()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn sign_evm_hash(&self) -> SignEvmHash<'_>
pub fn sign_evm_hash(&self) -> SignEvmHash<'_>
Sign hash
Signs an arbitrary 32 byte hash with the given EVM account.
Sends a `POST` request to `/v2/evm/accounts/{address}/sign`
Arguments:
- `address`: The 0x-prefixed address of the EVM account.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_evm_hash()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn sign_evm_message(&self) -> SignEvmMessage<'_>
pub fn sign_evm_message(&self) -> SignEvmMessage<'_>
Sign EIP-191 message
Signs an [EIP-191](https://eips.ethereum.org/EIPS/eip-191) message with the given EVM account.
Per the specification, the message in the request body is prepended with `0x19 <0x45 (E)> <thereum Signed Message:\n" + len(message)>` before being signed.
Sends a `POST` request to `/v2/evm/accounts/{address}/sign/message`
Arguments:
- `address`: The 0x-prefixed address of the EVM account.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_evm_message()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn sign_evm_transaction(&self) -> SignEvmTransaction<'_>
pub fn sign_evm_transaction(&self) -> SignEvmTransaction<'_>
Sign transaction
Signs a transaction with the given EVM account.
The transaction should be serialized as a hex string using [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/).
The transaction must be an [EIP-1559 dynamic fee transaction](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md). The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
Sends a `POST` request to `/v2/evm/accounts/{address}/sign/transaction`
Arguments:
- `address`: The 0x-prefixed address of the EVM account.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_evm_transaction()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn sign_evm_typed_data(&self) -> SignEvmTypedData<'_>
pub fn sign_evm_typed_data(&self) -> SignEvmTypedData<'_>
Sign EIP-712 typed data
Signs [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed data with the given EVM account.
Sends a `POST` request to `/v2/evm/accounts/{address}/sign/typed-data`
Arguments:
- `address`: The 0x-prefixed address of the EVM account.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_evm_typed_data()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn get_evm_eip7702_delegation_operation_by_id(
&self,
) -> GetEvmEip7702DelegationOperationById<'_>
pub fn get_evm_eip7702_delegation_operation_by_id( &self, ) -> GetEvmEip7702DelegationOperationById<'_>
Get EIP-7702 delegation operation by ID
Returns the EIP-7702 delegation operation. Use the delegationOperationId returned by the Create EIP-7702 delegation endpoint to poll for operation completion.
Sends a `GET` request to `/v2/evm/eip7702/delegation-operations/{delegationOperationId}`
Arguments:
- `delegation_operation_id`: The unique identifier for the delegation operation.
```ignore
let response = client.get_evm_eip7702_delegation_operation_by_id()
.delegation_operation_id(delegation_operation_id)
.send()
.await;
```Sourcepub fn request_evm_faucet(&self) -> RequestEvmFaucet<'_>
pub fn request_evm_faucet(&self) -> RequestEvmFaucet<'_>
Request funds on EVM test networks
Request funds from the CDP Faucet on supported EVM test networks.
Faucets are available for ETH, USDC, EURC, and cbBTC on Base Sepolia and Ethereum Sepolia, and for ETH only on Ethereum Hoodi.
To prevent abuse, we enforce rate limits within a rolling 24-hour window to control the amount of funds that can be requested.
These limits are applied at both the CDP User level and the blockchain address level.
A single blockchain address cannot exceed the specified limits, even if multiple users submit requests to the same address.
| Token | Amount per Faucet Request |Rolling 24-hour window Rate Limits|
|:-----:|:-------------------------:|:--------------------------------:|
| ETH | 0.0001 ETH | 0.1 ETH |
| USDC | 1 USDC | 10 USDC |
| EURC | 1 EURC | 10 EURC |
| cbBTC | 0.0001 cbBTC | 0.001 cbBTC |
Sends a `POST` request to `/v2/evm/faucet`
```ignore
let response = client.request_evm_faucet()
.body(body)
.send()
.await;
```Sourcepub fn list_evm_smart_accounts(&self) -> ListEvmSmartAccounts<'_>
pub fn list_evm_smart_accounts(&self) -> ListEvmSmartAccounts<'_>
List Smart Accounts
Lists the Smart Accounts belonging to the developer's CDP Project.
The response is paginated, and by default, returns 20 accounts per page.
Sends a `GET` request to `/v2/evm/smart-accounts`
Arguments:
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
```ignore
let response = client.list_evm_smart_accounts()
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Sourcepub fn create_evm_smart_account(&self) -> CreateEvmSmartAccount<'_>
pub fn create_evm_smart_account(&self) -> CreateEvmSmartAccount<'_>
Create Smart Account
Creates a new Smart Account.
Sends a `POST` request to `/v2/evm/smart-accounts`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.create_evm_smart_account()
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn get_evm_smart_account_by_name(&self) -> GetEvmSmartAccountByName<'_>
pub fn get_evm_smart_account_by_name(&self) -> GetEvmSmartAccountByName<'_>
Get Smart Account by name
Gets a Smart Account by its name.
Sends a `GET` request to `/v2/evm/smart-accounts/by-name/{name}`
Arguments:
- `name`: The name of the Smart Account.
```ignore
let response = client.get_evm_smart_account_by_name()
.name(name)
.send()
.await;
```Sourcepub fn get_evm_smart_account(&self) -> GetEvmSmartAccount<'_>
pub fn get_evm_smart_account(&self) -> GetEvmSmartAccount<'_>
Get Smart Account by address
Gets a Smart Account by its address.
Sends a `GET` request to `/v2/evm/smart-accounts/{address}`
Arguments:
- `address`: The 0x-prefixed address of the Smart Account.
```ignore
let response = client.get_evm_smart_account()
.address(address)
.send()
.await;
```Sourcepub fn update_evm_smart_account(&self) -> UpdateEvmSmartAccount<'_>
pub fn update_evm_smart_account(&self) -> UpdateEvmSmartAccount<'_>
Update EVM Smart Account
Updates an existing EVM smart account. Use this to update the smart account's name.
Sends a `PUT` request to `/v2/evm/smart-accounts/{address}`
Arguments:
- `address`: The 0x-prefixed address of the EVM smart account. The address does not need to be checksummed.
- `body`
```ignore
let response = client.update_evm_smart_account()
.address(address)
.body(body)
.send()
.await;
```Sourcepub fn redeem_vault_fees_with_evm_smart_account(
&self,
) -> RedeemVaultFeesWithEvmSmartAccount<'_>
pub fn redeem_vault_fees_with_evm_smart_account( &self, ) -> RedeemVaultFeesWithEvmSmartAccount<'_>
Redeem vault fees with an EVM Smart Account
Redeems every vault share held by the vault's fee recipient EVM Smart Account for the vault's underlying asset (e.g. USDC). The Smart Account must be the vault's fee recipient, and its owner must be a CDP EVM account.
CDP periodically distributes each vault's accrued fees to its fee recipient as vault shares. This API redeems the Smart Account's full share balance, including any shares from the Smart Account's own deposits into the vault, so use a dedicated fee recipient Smart Account.
The share approval and redemption are batched into a single user operation.
For fee recipients that are EVM accounts, use `redeemVaultFeesWithEvmAccount` instead.
Sends a `POST` request to `/v2/evm/smart-accounts/{address}/lend/redeem-fees`
Arguments:
- `address`: The 0x-prefixed address of the EVM Smart Account that is the vault's fee recipient.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.redeem_vault_fees_with_evm_smart_account()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn create_spend_permission(&self) -> CreateSpendPermission<'_>
pub fn create_spend_permission(&self) -> CreateSpendPermission<'_>
Create spend permission
Creates a spend permission for the given smart account address.
Sends a `POST` request to `/v2/evm/smart-accounts/{address}/spend-permissions`
Arguments:
- `address`: The address of the Smart Account to create the spend permission for.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.create_spend_permission()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn list_spend_permissions(&self) -> ListSpendPermissions<'_>
pub fn list_spend_permissions(&self) -> ListSpendPermissions<'_>
List spend permissions
Lists spend permission for the given smart account address.
Sends a `GET` request to `/v2/evm/smart-accounts/{address}/spend-permissions/list`
Arguments:
- `address`: The address of the Smart account to list spend permissions for.
- `page_size`: The number of spend permissions to return per page.
- `page_token`: The token for the next page of spend permissions. Will be empty if there are no more spend permissions to fetch.
```ignore
let response = client.list_spend_permissions()
.address(address)
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Sourcepub fn revoke_spend_permission(&self) -> RevokeSpendPermission<'_>
pub fn revoke_spend_permission(&self) -> RevokeSpendPermission<'_>
Revoke spend permission
Revokes an existing spend permission.
Sends a `POST` request to `/v2/evm/smart-accounts/{address}/spend-permissions/revoke`
Arguments:
- `address`: The address of the Smart account this spend permission is valid for.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.revoke_spend_permission()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn prepare_user_operation(&self) -> PrepareUserOperation<'_>
pub fn prepare_user_operation(&self) -> PrepareUserOperation<'_>
Prepare user operation
Prepares a new user operation on a Smart Account for a specific network.
Sends a `POST` request to `/v2/evm/smart-accounts/{address}/user-operations`
Arguments:
- `address`: The address of the Smart Account to create the user operation on.
- `body`
```ignore
let response = client.prepare_user_operation()
.address(address)
.body(body)
.send()
.await;
```Sourcepub fn prepare_and_send_user_operation(&self) -> PrepareAndSendUserOperation<'_>
pub fn prepare_and_send_user_operation(&self) -> PrepareAndSendUserOperation<'_>
Prepare and send user operation
Prepares, signs, and sends a user operation for an EVM Smart Account. This API can be used only if the owner on Smart Account is a CDP EVM Account.
Sends a `POST` request to `/v2/evm/smart-accounts/{address}/user-operations/prepare-and-send`
Arguments:
- `address`: The address of the EVM Smart Account to execute the user operation from.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.prepare_and_send_user_operation()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn get_user_operation(&self) -> GetUserOperation<'_>
pub fn get_user_operation(&self) -> GetUserOperation<'_>
Get user operation
Gets a user operation by its hash.
Sends a `GET` request to `/v2/evm/smart-accounts/{address}/user-operations/{userOpHash}`
Arguments:
- `address`: The address of the Smart Account the user operation belongs to.
- `user_op_hash`: The hash of the user operation to fetch.
```ignore
let response = client.get_user_operation()
.address(address)
.user_op_hash(user_op_hash)
.send()
.await;
```Sourcepub fn send_user_operation(&self) -> SendUserOperation<'_>
pub fn send_user_operation(&self) -> SendUserOperation<'_>
Send user operation
Sends a user operation with a signature.
The payload to sign must be the `userOpHash` field of the user operation. This hash should be signed directly (not using `personal_sign` or EIP-191 message hashing).
The signature must be 65 bytes in length, consisting of: - 32 bytes for the `r` value - 32 bytes for the `s` value - 1 byte for the `v` value (must be 27 or 28)
If using the CDP Paymaster, the user operation must be signed and sent within 2 minutes of being prepared.
Sends a `POST` request to `/v2/evm/smart-accounts/{address}/user-operations/{userOpHash}/send`
Arguments:
- `address`: The address of the Smart Account to send the user operation from.
- `user_op_hash`: The hash of the user operation to send.
- `body`
```ignore
let response = client.send_user_operation()
.address(address)
.user_op_hash(user_op_hash)
.body(body)
.send()
.await;
```Sourcepub fn create_evm_swap_quote(&self) -> CreateEvmSwapQuote<'_>
pub fn create_evm_swap_quote(&self) -> CreateEvmSwapQuote<'_>
Create swap quote
Create a swap quote, which includes the payload to sign as well as the transaction data needed to execute the swap. The developer is responsible for signing the payload and submitting the transaction to the network in order to execute the swap.
Sends a `POST` request to `/v2/evm/swaps`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.create_evm_swap_quote()
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn get_evm_swap_price(&self) -> GetEvmSwapPrice<'_>
pub fn get_evm_swap_price(&self) -> GetEvmSwapPrice<'_>
Get swap price estimate
Get a price estimate for a swap between two tokens on an EVM network.
Sends a `GET` request to `/v2/evm/swaps/quote`
```ignore
let response = client.get_evm_swap_price()
.from_amount(from_amount)
.from_token(from_token)
.gas_price(gas_price)
.network(network)
.signer_address(signer_address)
.slippage_bps(slippage_bps)
.taker(taker)
.to_token(to_token)
.send()
.await;
```Sourcepub fn list_evm_token_balances(&self) -> ListEvmTokenBalances<'_>
pub fn list_evm_token_balances(&self) -> ListEvmTokenBalances<'_>
List EVM token balances
Lists the token balances of an EVM address on a given network. The balances include ERC-20 tokens and the native gas token (usually ETH). The response is paginated, and by default, returns 20 balances per page.
Calls to the `base` and `base-sepolia` networks offer:
* 99.5% < 2 second freshness from chain tip for new tokens on an address.
* 99.5% < 2 second freshness from chain tip for balance data.
Calls to the `ethereum` network offer:
* 99% < 30 second freshness from chain tip for new tokens on an address.
* 99% < 2 second freshness from chain tip for balance data.
Sends a `GET` request to `/v2/evm/token-balances/{network}/{address}`
Arguments:
- `network`: The human-readable network name to get the balances for.
- `address`: The 0x-prefixed EVM address to get balances for. The address does not need to be checksummed.
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
```ignore
let response = client.list_evm_token_balances()
.network(network)
.address(address)
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Sourcepub fn list_mandates(&self) -> ListMandates<'_>
pub fn list_mandates(&self) -> ListMandates<'_>
List mandates
Returns a paginated list of mandates that the API key has permission to access. Filter by `address` (the funding `source`), `network`, and `status`.
Sends a `GET` request to `/v2/mandates`
Arguments:
- `address`: Filter mandates by the customer's wallet address.
- `network`: Filter mandates by the customer's wallet network. Only applies when `address` is also provided.
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
- `status`: Filter mandates by their latest action, e.g. `approval_succeeded` for mandates whose most recent transition was a successful approval. Note that `status` tracks the latest action, not usability; usability is derived from the `approvedAt`, `canceledAt`, and `revokedAt` timestamps.
```ignore
let response = client.list_mandates()
.address(address)
.network(network)
.page_size(page_size)
.page_token(page_token)
.status(status)
.send()
.await;
```Sourcepub fn create_mandate(&self) -> CreateMandate<'_>
pub fn create_mandate(&self) -> CreateMandate<'_>
Create a mandate
Creates a mandate denominated in `asset`. Optionally set `policy` to cap debits; if omitted, a Coinbase-configured monthly max applies. The response always includes the resolved `policy`.
Returns the mandate in `created` status with no `source`; it is not yet usable. Next step: have the customer approve it with **Get wallet approval options** then **Approve a mandate with a wallet**, which attaches the `source` and moves the mandate to `approval_succeeded`.
A mandate's terms can't be modified once created. To change them, cancel the mandate and create a new one.
Sends a `POST` request to `/v2/mandates`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.create_mandate()
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn get_mandate(&self) -> GetMandate<'_>
pub fn get_mandate(&self) -> GetMandate<'_>
Get a mandate
Retrieves a single mandate by its ID, including its current `status`, `policy`, and `source`.
Sends a `GET` request to `/v2/mandates/{mandateId}`
Arguments:
- `mandate_id`: The unique identifier of the mandate.
```ignore
let response = client.get_mandate()
.mandate_id(mandate_id)
.send()
.await;
```Sourcepub fn list_mandate_approvals(&self) -> ListMandateApprovals<'_>
pub fn list_mandate_approvals(&self) -> ListMandateApprovals<'_>
List mandate approvals
Returns the approvals for a mandate, most recent first. Each approval is an attempt to attach a funding `source`; inspect them to see why a mandate is not yet `approval_succeeded`: a `pending` attempt is still in progress, a `failed` one carries an `error`.
Sends a `GET` request to `/v2/mandates/{mandateId}/approvals`
Arguments:
- `mandate_id`: The unique identifier of the mandate.
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
```ignore
let response = client.list_mandate_approvals()
.mandate_id(mandate_id)
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Sourcepub fn approve_wallet_mandate(&self) -> ApproveWalletMandate<'_>
pub fn approve_wallet_mandate(&self) -> ApproveWalletMandate<'_>
Approve a mandate with a wallet
**Customer-initiated.** Approves a mandate on a wallet source using the customer's signed payloads from **Get wallet approval options**. The customer signs the payloads themselves, so this call is unauthenticated. The mandate must be in `created` or `approval_failed` status, not expired, and have no approval or revocation in flight.
Returns a `pending` approval and moves the mandate to `approval_pending`. On success the mandate's `source` is set and `status` becomes `approval_succeeded`; it can then be used by **Authorize a payment session with a mandate**. On failure `status` becomes `approval_failed` and a new approval can be submitted. Follow progress with **Get a mandate approval** or the `acceptance.mandate.approval_*` webhooks.
Sends a `POST` request to `/v2/mandates/{mandateId}/approvals/wallet`
Arguments:
- `mandate_id`: The unique identifier of the mandate to approve.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.approve_wallet_mandate()
.mandate_id(mandate_id)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn get_wallet_approval_options(&self) -> GetWalletApprovalOptions<'_>
pub fn get_wallet_approval_options(&self) -> GetWalletApprovalOptions<'_>
Get wallet approval options
Returns the available wallet approval options for a mandate. The mandate must be in `created` or `approval_failed` status, not expired, and have no approval or revocation in flight.
Provide one or more customer wallet addresses as query parameters. Each option specifies the network, asset, and payloads the customer must sign to approve the mandate. Present the options to the customer and let them choose one, then call **Approve a mandate with a wallet** with the selected option and its signed payloads.
This is a stateless read operation and does not modify the mandate. The payloads embed fresh on-chain signing data such as a `nonce` and `deadline`, so sign and submit the payloads from a single response rather than caching them.
If a requested address has no eligible approval options, it appears in `ineligibleAddresses` with a `code` and `message` instead of being absent from `options`.
Sends a `GET` request to `/v2/mandates/{mandateId}/approvals/wallet/options`
Arguments:
- `mandate_id`: The unique identifier of the mandate.
- `addresses`: The customer's wallet addresses to generate approval options for. Provide between 1 and 5 unique addresses, comma-separated (e.g. `?addresses=0xA,0xB`). Each returned option's `source.address` identifies which requested address it applies to. If a requested address has no eligible approval options, it appears in `ineligibleAddresses` with a `code` explaining why.
- `asset`: Filter options by asset. Currently, only `usdc` and `usdt` return results.
- `network`: Optional filter to restrict options to a specific blockchain network.
```ignore
let response = client.get_wallet_approval_options()
.mandate_id(mandate_id)
.addresses(addresses)
.asset(asset)
.network(network)
.send()
.await;
```Sourcepub fn get_mandate_approval(&self) -> GetMandateApproval<'_>
pub fn get_mandate_approval(&self) -> GetMandateApproval<'_>
Get a mandate approval
Retrieves a single approval by its ID, including its current `status`, its `onchainTransactions` once submitted, and, when it failed, its `error`. Poll this after **Approve a mandate with a wallet** to follow a `pending` approval to `succeeded` or `failed`, or consume the mandate webhooks instead.
Sends a `GET` request to `/v2/mandates/{mandateId}/approvals/{approvalId}`
Arguments:
- `mandate_id`: The unique identifier of the mandate.
- `approval_id`: The unique identifier of the approval.
```ignore
let response = client.get_mandate_approval()
.mandate_id(mandate_id)
.approval_id(approval_id)
.send()
.await;
```Sourcepub fn cancel_mandate(&self) -> CancelMandate<'_>
pub fn cancel_mandate(&self) -> CancelMandate<'_>
Cancel a mandate
Ends the mandate off-chain. `status` becomes `canceled`, `canceledAt` is set, and new authorizations are blocked immediately; authorizations already in progress are not affected. Cancel can be called from any status except a fully revoked one (`revokedAt` set); canceling an already canceled mandate is a no-op that returns the mandate unchanged.
Canceling does not touch the on-chain spending allowance, which may still be live afterward. The customer removes it separately with **Revoke a mandate with a wallet**; that later revocation sets `revokedAt` while `canceledAt` remains set.
Sends a `POST` request to `/v2/mandates/{mandateId}/cancel`
Arguments:
- `mandate_id`: The unique identifier of the mandate to cancel.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.cancel_mandate()
.mandate_id(mandate_id)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn list_mandate_revocations(&self) -> ListMandateRevocations<'_>
pub fn list_mandate_revocations(&self) -> ListMandateRevocations<'_>
List mandate revocations
Returns all wallet revocations for the mandate, newest first. Each records an attempt to remove the spending allowance on-chain. A `succeeded` entry means the allowance has been removed.
Sends a `GET` request to `/v2/mandates/{mandateId}/revocations`
Arguments:
- `mandate_id`: The unique identifier of the mandate.
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
```ignore
let response = client.list_mandate_revocations()
.mandate_id(mandate_id)
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Sourcepub fn revoke_wallet_mandate(&self) -> RevokeWalletMandate<'_>
pub fn revoke_wallet_mandate(&self) -> RevokeWalletMandate<'_>
Revoke a mandate with a wallet
**Customer-initiated.** Removes the mandate's spending allowance on-chain using the customer's signed payloads from **Get wallet revocation options**. The customer signs the payloads themselves, so this call is unauthenticated. The mandate must have an active allowance and no approval or revocation in flight.
Returns a `pending` revocation and moves the mandate to `revocation_pending`. When the network transaction confirms, `revokedAt` is set and `status` becomes `revocation_succeeded`; if it does not complete, `status` becomes `revocation_failed` and a new revocation can be submitted. Follow progress with **Get a mandate revocation** or the `acceptance.mandate.revocation_*` webhooks.
A canceled mandate can still be revoked: the revocation sets `revokedAt` while `canceledAt` remains set.
Sends a `POST` request to `/v2/mandates/{mandateId}/revocations/wallet`
Arguments:
- `mandate_id`: The unique identifier of the mandate to revoke.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.revoke_wallet_mandate()
.mandate_id(mandate_id)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn get_wallet_revocation_options(&self) -> GetWalletRevocationOptions<'_>
pub fn get_wallet_revocation_options(&self) -> GetWalletRevocationOptions<'_>
Get wallet revocation options
Returns the payloads the customer must sign to remove the mandate's spending allowance on-chain. The mandate must have an active allowance (approval succeeded, not yet revoked) and no approval or revocation in flight. A canceled mandate can still be revoked while its allowance is live.
Present the payloads to the customer to sign, then call **Revoke a mandate with a wallet** with the signed payloads.
This is a stateless read operation and does not modify the mandate. The payloads embed fresh signing data on each call, so sign and submit the payloads from a single response rather than caching them.
Sends a `GET` request to `/v2/mandates/{mandateId}/revocations/wallet/options`
Arguments:
- `mandate_id`: The unique identifier of the mandate.
```ignore
let response = client.get_wallet_revocation_options()
.mandate_id(mandate_id)
.send()
.await;
```Sourcepub fn get_mandate_revocation(&self) -> GetMandateRevocation<'_>
pub fn get_mandate_revocation(&self) -> GetMandateRevocation<'_>
Get a mandate revocation
Retrieves a single revocation by ID.
Sends a `GET` request to `/v2/mandates/{mandateId}/revocations/{revocationId}`
Arguments:
- `mandate_id`: The unique identifier of the mandate.
- `revocation_id`: The unique identifier of the revocation.
```ignore
let response = client.get_mandate_revocation()
.mandate_id(mandate_id)
.revocation_id(revocation_id)
.send()
.await;
```Sourcepub fn get_onramp_user_limits(&self) -> GetOnrampUserLimits<'_>
pub fn get_onramp_user_limits(&self) -> GetOnrampUserLimits<'_>
Get onramp user limits
Returns the transaction limits for an onramp user based on their payment method and user identifier. Use this API to show users their remaining purchase capacity before initiating an onramp transaction.
Currently supports `GUEST_CHECKOUT_APPLE_PAY` payment method with phone number identification. The phone number must have been previously verified via OTP.
Sends a `POST` request to `/v2/onramp/limits`
```ignore
let response = client.get_onramp_user_limits()
.body(body)
.send()
.await;
```Sourcepub fn request_limits_upgrade(&self) -> RequestLimitsUpgrade<'_>
pub fn request_limits_upgrade(&self) -> RequestLimitsUpgrade<'_>
Request limit upgrade
Requests a limit upgrade for an onramp user. Only phone number is currently supported as a userId.
The default API mode submits identity information directly and returns HTTP 202 when the request is accepted. Embedded mode (`interactionMode: embedded`) returns a Coinbase-hosted `upgradeUrl` where the user enters identity information.
The verification process is asynchronous. After calling this endpoint, use the [Get Onramp User Limits](https://docs.cdp.coinbase.com/api-reference/v2/rest-api/onramp/get-onramp-user-limits) endpoint to check the status in the `limitUpgradeOptions` array.
**Prerequisites:**
- The phone number must have been previously verified by your app via OTP. - Upgrades may not be available until a certain number of successful transactions by the user.
**Supported fields:**
- `ssnLast4`: Last 4 digits of the Social Security Number (no dashes or spaces).
- `dateOfBirth`: Date of birth (day, month, year as zero-padded strings).
Sends a `POST` request to `/v2/onramp/limits/upgrade`
```ignore
let response = client.request_limits_upgrade()
.body(body)
.send()
.await;
```Sourcepub fn create_onramp_ios_attestation_challenge(
&self,
) -> CreateOnrampIosAttestationChallenge<'_>
pub fn create_onramp_ios_attestation_challenge( &self, ) -> CreateOnrampIosAttestationChallenge<'_>
Create an onramp iOS attestation challenge
Issues a one-time challenge for the iOS App Attest device-key **registration** step. Authenticate with a CDP API key. Call this from the partner backend and pass the challenge to the mobile app; do not embed the API key in the client. The project is identified by the API key JWT. The partner app then passes the challenge to `DCAppAttestService.attestKey(keyId, clientDataHash: SHA256(challenge))` and submits the resulting attestation to [Register Onramp iOS Attestation](#operation/registerOnrampIosAttestation).
This is distinct from [Create Onramp Mobile Challenge](#operation/createOnrampMobileChallenge), which issues the per-transaction session challenge. Registration is a one-time, per-device-install operation; iOS-only (Android validates Play Integrity inline per request and has no registration step).
Sends a `POST` request to `/v2/onramp/mobile/attestation/challenges`
```ignore
let response = client.create_onramp_ios_attestation_challenge()
.send()
.await;
```Sourcepub fn register_onramp_ios_attestation(
&self,
) -> RegisterOnrampIosAttestation<'_>
pub fn register_onramp_ios_attestation( &self, ) -> RegisterOnrampIosAttestation<'_>
Register a device key for iOS App Attest
Verifies an iOS App Attest attestation payload and registers the device's public key for future assertion validation. The server checks that the attestation is genuine and signed by Apple, that the bundle ID is in the partner's allowed mobile clients list, and that the challenge issued by [Create Onramp iOS Attestation Challenge](#operation/createOnrampIosAttestationChallenge) is fresh and unused.
This is a one-time, per-device-install operation; iOS-only (Android validates Play Integrity inline per request and has no registration step). For security, all client-side verification failures are returned as an opaque `400 invalid_request` — the response never reveals which specific check failed.
The Apple App Attest `keyId` is supplied only in the request body (`ios.keyId`). Do not put `keyId` in the URL — App Attest key IDs are standard base64 and frequently contain `/`, which breaks path routing at the edge.
Idempotency is provided by `ios.keyId` itself: the server upserts the device public key on `(app, keyId)`, so repeating registration for the same key replaces the stored public key rather than creating a duplicate. This endpoint does not accept `X-Idempotency-Key` — `ios.keyId` is the natural idempotency key for the registration resource. The challenge remains single-use and is claimed on first receipt. The challenge identifies the project; the device does not supply a CDP project ID.
Sends a `POST` request to `/v2/onramp/mobile/attestation/registrations`
```ignore
let response = client.register_onramp_ios_attestation()
.body(body)
.send()
.await;
```Sourcepub fn create_onramp_mobile_session(&self) -> CreateOnrampMobileSession<'_>
pub fn create_onramp_mobile_session(&self) -> CreateOnrampMobileSession<'_>
Create an onramp mobile session
Verifies the platform attestation for a challenge issued by [Create Onramp Mobile Challenge](#operation/createOnrampMobileChallenge) and returns a ready-to-use onramp URL. The URL embeds the session token as a query parameter so the Coinbase app can populate the handoff screen immediately on launch.
This endpoint is idempotent on the challenge token: if the same challenge is submitted again (e.g. due to a lost response), the server returns the original session URL rather than an error.
Provide exactly one platform payload: `ios` (App Attest assertion) or `android` (Play Integrity token).
Sends a `POST` request to `/v2/onramp/mobile/sessions`
```ignore
let response = client.create_onramp_mobile_session()
.body(body)
.send()
.await;
```Sourcepub fn create_onramp_mobile_challenge(&self) -> CreateOnrampMobileChallenge<'_>
pub fn create_onramp_mobile_challenge(&self) -> CreateOnrampMobileChallenge<'_>
Create an onramp mobile challenge
Issues a challenge for initiating an onramp flow from a partner mobile app. Authenticate this request from the partner backend with a CDP API key; do not embed the API key in the mobile client. The project is identified by the API key JWT.
Pass the challenge to the mobile app. The app signs it using platform attestation (iOS App Attest or Android Play Integrity) and submits it to the [Create Onramp Mobile Session](#operation/createOnrampMobileSession) endpoint without CDP API key authentication to obtain a ready-to-use onramp URL. The `redirectUrl` is required so the Coinbase app knows where to return the user after completing or dismissing the transaction.
Sends a `POST` request to `/v2/onramp/mobile/sessions/challenges`
```ignore
let response = client.create_onramp_mobile_challenge()
.body(body)
.send()
.await;
```Sourcepub fn create_onramp_order(&self) -> CreateOnrampOrder<'_>
pub fn create_onramp_order(&self) -> CreateOnrampOrder<'_>
Create an onramp order
Create a new Onramp order or get a quote for an Onramp order. Either `paymentAmount` or `purchaseAmount` must be provided.
This API supports two modes:
**Headless mode (standard)**: returns a seamless Apple Pay or Google Pay button that you integrate directly into your app. Your app collects and verifies the user's contact details before calling this endpoint — `phoneNumber`, `email`, `phoneNumberVerifiedAt`, and `agreementAcceptedAt` are required and enforced server-side.
**Embedded mode**: returns a webview that collects and verifies the user's contact and identity information, then shows the payment screen. Omit both `phoneNumber` and `email` from the request to select this mode. Embedded mode requires account enablement; contact the Onramp team for access.
Read more about the difference between the two modes in the [Headless Onramp overview](https://docs.cdp.coinbase.com/onramp/headless-onramp/overview).
This API supports the `GUEST_CHECKOUT_APPLE_PAY` and `GUEST_CHECKOUT_GOOGLE_PAY` payment methods.
For detailed integration instructions and to get access to this API, refer to the [Guest Checkout Onramp API docs](https://docs.cdp.coinbase.com/onramp/headless-onramp/overview).
Sends a `POST` request to `/v2/onramp/orders`
Arguments:
- `x_onramp_partner_id`: The Onramp-issued identifier of a disclosed end partner, scoped to an aggregator's developer app. Aggregators integrating Onramp on behalf of multiple end partners set this header to attribute a request to one of their registered partners; omit it for standard, non-aggregator integrations. Only honored for developer apps registered as an aggregator — requires Onramp aggregator onboarding, including registration of each end partner. Contact the Onramp team for access.
- `body`
```ignore
let response = client.create_onramp_order()
.x_onramp_partner_id(x_onramp_partner_id)
.body(body)
.send()
.await;
```Sourcepub fn get_onramp_order_by_id(&self) -> GetOnrampOrderById<'_>
pub fn get_onramp_order_by_id(&self) -> GetOnrampOrderById<'_>
Get an onramp order by ID
Get an onramp order by ID.
Sends a `GET` request to `/v2/onramp/orders/{orderId}`
Arguments:
- `order_id`: The ID of the onramp order to retrieve.
```ignore
let response = client.get_onramp_order_by_id()
.order_id(order_id)
.send()
.await;
```Sourcepub fn create_onramp_session(&self) -> CreateOnrampSession<'_>
pub fn create_onramp_session(&self) -> CreateOnrampSession<'_>
Create an onramp session
Returns a single-use URL for an Onramp session. This API provides flexible functionality based on the parameters provided, supporting three cases:
**Important**: The returned URL is single-use only. Once a user visits the URL, no one else can access it.
# Use Cases
## 1. Basic Session (Minimum Parameters)
**Required**: `destinationAddress`, `purchaseCurrency`, `destinationNetwork`
**Returns**: Basic single-use onramp URL. The `quote` object will not be included in the response.
## 2. One-Click Onramp URL
**Required**: Basic parameters + (`paymentAmount` OR `purchaseAmount`), `paymentCurrency`
**Returns**: One-click onramp URL for streamlined checkout. The `quote` object will not be included in the response.
## 3. One-Click Onramp URL with Quote
**Required**: One-Click Onramp parameters + `paymentMethod`, `country`, `subdivision`
**Returns**: Complete pricing quote and one-click onramp URL. Both `session` and `quote` objects will be included in the response.
**Note**: Only one of `paymentAmount` or `purchaseAmount` should be provided, not both. Providing both will result in an error. When `paymentAmount` is provided, the quote shows how much crypto the user will receive for the specified fiat amount (fee-inclusive). When `purchaseAmount` is provided, the quote shows how much fiat the user needs to pay for the specified crypto amount (fee-exclusive).
Sends a `POST` request to `/v2/onramp/sessions`
Arguments:
- `x_onramp_partner_id`: The Onramp-issued identifier of a disclosed end partner, scoped to an aggregator's developer app. Aggregators integrating Onramp on behalf of multiple end partners set this header to attribute a request to one of their registered partners; omit it for standard, non-aggregator integrations. Only honored for developer apps registered as an aggregator — requires Onramp aggregator onboarding, including registration of each end partner. Contact the Onramp team for access.
- `body`
```ignore
let response = client.create_onramp_session()
.x_onramp_partner_id(x_onramp_partner_id)
.body(body)
.send()
.await;
```Sourcepub fn initiate_onramp_verification(&self) -> InitiateOnrampVerification<'_>
pub fn initiate_onramp_verification(&self) -> InitiateOnrampVerification<'_>
Initiate onramp verification
Initiates OTP verification by sending a 6-digit code to the user via the specified channel (SMS or email). Returns a `verificationId` that must be passed to the Submit Onramp Verification endpoint along with the OTP code within 10 minutes.
**Access to this API requires allowlisting.** During Onramp Headless API onboarding, contact the Onramp team to enable Onramp-managed verification for your application.
Sends a `POST` request to `/v2/onramp/verifications`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.initiate_onramp_verification()
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn submit_onramp_verification(&self) -> SubmitOnrampVerification<'_>
pub fn submit_onramp_verification(&self) -> SubmitOnrampVerification<'_>
Submit onramp verification
Submits the OTP code to complete verification. On success, marks the verification as verified and returns the same `verificationId`. The destination does not need to be re-sent. Onramp uses the value captured at initiation time.
The returned `verificationId` should be stored on the user's device and passed to the Create Onramp Order endpoint. It is valid for 60 days.
**Access to this API requires allowlisting.** During Onramp Headless API onboarding, contact the Onramp team to enable Onramp-managed verification for your application.
Sends a `POST` request to `/v2/onramp/verifications/{verificationId}/submit`
Arguments:
- `verification_id`: The verification ID returned by the Initiate Onramp Verification endpoint.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.submit_onramp_verification()
.verification_id(verification_id)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn list_payment_methods(&self) -> ListPaymentMethods<'_>
pub fn list_payment_methods(&self) -> ListPaymentMethods<'_>
List payment methods
List payment methods linked to your entity. Payment methods represent external financial instruments that can be used as a target for transfers. The list will not include disabled or deleted payment methods.
**Currently Supported Types:**
- `fedwire`: Domestic USD wire transfers
- `swift`: International wire transfers
- `sepa`: SEPA EUR transfers
**Note:** Payment methods are created and verified through your linked CDP entity. Currently, fetching payment methods is only supported for Prime investment vehicles linked to CDP.
Sends a `GET` request to `/v2/payment-methods`
Arguments:
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
```ignore
let response = client.list_payment_methods()
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Sourcepub fn get_payment_method(&self) -> GetPaymentMethod<'_>
pub fn get_payment_method(&self) -> GetPaymentMethod<'_>
Get payment method
Get details of a specific payment method by its ID. Returns 404 if the payment method is not found or not owned by the requesting entity.
Sends a `GET` request to `/v2/payment-methods/{paymentMethodId}`
Arguments:
- `payment_method_id`: The unique identifier of the payment method.
```ignore
let response = client.get_payment_method()
.payment_method_id(payment_method_id)
.send()
.await;
```Sourcepub fn list_payment_sessions(&self) -> ListPaymentSessions<'_>
pub fn list_payment_sessions(&self) -> ListPaymentSessions<'_>
List payment sessions
Returns a paginated list of payment sessions that the API key has permission to access.
Sends a `GET` request to `/v2/payment-sessions`
Arguments:
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
```ignore
let response = client.list_payment_sessions()
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Sourcepub fn create_payment_session(&self) -> CreatePaymentSession<'_>
pub fn create_payment_session(&self) -> CreatePaymentSession<'_>
Create a payment session
Creates a payment session that defines what is being paid — amount, asset, and target. Optionally configure execution behavior, expiry deadlines, redirect URLs, and metadata.
If expiry deadlines are omitted, sensible defaults are applied (1 day for authorization, 7 days for capture, 30 days for refund). Expiries must be in ascending order — see the `expiries` object for details and constraints.
Returns the session in `created` status. Next step: call one of the authorization endpoints (wallet or Coinbase) to authorize the payment.
Sends a `POST` request to `/v2/payment-sessions`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.create_payment_session()
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn get_payment_session(&self) -> GetPaymentSession<'_>
pub fn get_payment_session(&self) -> GetPaymentSession<'_>
Get a payment session
Retrieves a single payment session by its ID, including its current status, balances, and associated metadata. The API key must have permission to access the requested session.
Sends a `GET` request to `/v2/payment-sessions/{paymentSessionId}`
Arguments:
- `payment_session_id`: The unique identifier of the payment session.
```ignore
let response = client.get_payment_session()
.payment_session_id(payment_session_id)
.send()
.await;
```List payment session authorizations
Returns a paginated list of authorizations for a payment session. Each authorization represents a hold on funds and includes its current status and amount.
Sends a `GET` request to `/v2/payment-sessions/{paymentSessionId}/authorizations`
Arguments:
- `payment_session_id`: The unique identifier of the payment session.
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
```ignore
let response = client.list_payment_session_authorizations()
.payment_session_id(payment_session_id)
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Authorize a payment session with a Coinbase account
**Merchant-initiated.** The merchant charges the payer's Coinbase account using an OAuth grant the payer authorized earlier, so the payer does not need to be present at payment time. The session must be in `created` status.
**Authentication:** Requires a Coinbase OAuth Bearer token with the `coinbase:stablecoins:payment-create` scope.
On authorization, a hold is placed on the payer's funds. The authorization is returned in `pending` status and transitions asynchronously to `succeeded` or `failed`.
If `autoCapture` is enabled on the session, a capture is automatically created after a successful authorization.
Sends a `POST` request to `/v2/payment-sessions/{paymentSessionId}/authorizations/coinbase`
Arguments:
- `payment_session_id`: The unique identifier of the payment session to authorize via Coinbase.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `cb_authz_id`: The `authorizationId` returned from a successful `POST https://login.coinbase.com/api/v1/authorization-challenges` step. Identifies the MFA challenge that gates this authorization. Must be a lowercase UUID v4.
- `body`
```ignore
let response = client.authorize_coinbase_payment_session()
.payment_session_id(payment_session_id)
.x_idempotency_key(x_idempotency_key)
.cb_authz_id(cb_authz_id)
.body(body)
.send()
.await;
```Authorize a payment session with a mandate
**Merchant-initiated.** The merchant draws against a mandate in `approval_succeeded` status using the mandate's existing approval, so no fresh signature is required and the customer does not need to be present. The session must be in `created` status and the mandate must be in `approval_succeeded` status. When more than one mandate condition applies, the first match wins: an in-flight approval or revocation returns `409` (`mandate_action_pending`); `revokedAt` set returns `422` (`mandate_revoked`); `canceledAt` set returns `422` (`mandate_canceled`); a past `expiresAt` returns `400` (`mandate_expired`); any other status returns `422` (`mandate_invalid_status`).
It requires API key authentication: unlike the payer-present wallet flow there is no per-call signature to prove consent, so the merchant authenticates as the party entitled to draw against the mandate.
The charge must fall within the mandate's `policy`. Exceeding `maxPerAuthorization` or `maxPerPeriod` returns `422` (`mandate_policy_violation`).
On authorization, a hold is placed on the payer's funds. The authorization is returned in `pending` status and transitions asynchronously to `succeeded` or `failed`. If `autoCapture` is enabled on the session, a capture is automatically created after a successful authorization.
Sends a `POST` request to `/v2/payment-sessions/{paymentSessionId}/authorizations/mandate`
Arguments:
- `payment_session_id`: The unique identifier of the payment session to authorize.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.authorize_mandate_payment_session()
.payment_session_id(payment_session_id)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Authorize a payment session with a wallet
**Customer-initiated.** Authorizes a payment session using the payer's wallet. The payer signs the payloads themselves, so this call is unauthenticated. The session must be in `created` status.
The `optionId` must match one of the options returned by the **Get Wallet Authorization Options** endpoint. Include the signed payloads for the selected option.
On authorization, a hold is placed on the payer's funds. The authorization is returned in `pending` status and transitions asynchronously to `succeeded` or `failed`.
If `autoCapture` is enabled on the session, a capture is automatically created after a successful authorization.
Sends a `POST` request to `/v2/payment-sessions/{paymentSessionId}/authorizations/wallet`
Arguments:
- `payment_session_id`: The unique identifier of the payment session to authorize.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.authorize_wallet_payment_session()
.payment_session_id(payment_session_id)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Get wallet authorization options
Returns the available wallet authorization options for a payment session. The session must be in `created` status.
Provide one or more payer wallet addresses as query parameters. Each option specifies the currency, amount, network, and payloads the payer must sign to authorize the payment. Present the options to the payer and let them choose one, then call **Authorize Wallet** with the selected option.
This is a stateless read operation — the session is not modified.
If a requested address has no eligible authorization options (e.g. insufficient funds), it appears in `ineligibleAddresses` with a `code` and `message` instead of being absent from `options`. When an address is ineligible because of `insufficient_funds`, its `fundsRequired` array lists, per enabled (network, asset) combination, the current balance and required balance the payer needs to become eligible.
Sends a `GET` request to `/v2/payment-sessions/{paymentSessionId}/authorizations/wallet/options`
Arguments:
- `payment_session_id`: The unique identifier of the payment session.
- `addresses`: The payer wallet addresses to generate authorization options for. Provide between 1 and 5 unique addresses, comma-separated (e.g. `?addresses=0xA,0xB`). Each returned option's `source.address` identifies which requested address it applies to. If a requested address has no eligible authorization options, it appears in `ineligibleAddresses` with a `code` explaining why.
- `asset`: Filter options by asset. Currently, only `usdc` and `usdt` return results.
- `network`: Optional filter to restrict options to a specific blockchain network.
```ignore
let response = client.get_wallet_authorization_options()
.payment_session_id(payment_session_id)
.addresses(addresses)
.asset(asset)
.network(network)
.send()
.await;
```Authorize a payment session with x402
**Customer-initiated.** Authorizes a payment session using x402. The payer supplies the payment payload, so this call is unauthenticated. The session must be in `created` status.
The client sends no request body. You may supply the base64-encoded x402-compliant payment payload in the optional **`PAYMENT-SIGNATURE`** header.
On authorization, a hold is placed on the payer's funds. The authorization is returned in `pending` status and transitions asynchronously to `succeeded` or `failed`.
**402 Payment Required** may be returned when payment must be supplied before authorization can proceed. The **402** response uses the standard CDP **`Error`** JSON body and may include a **`PAYMENT-REQUIRED`** header (see the **402** response) describing accepted networks, assets, and amounts.
If `autoCapture` is enabled on the session, a capture is automatically created after a successful authorization.
Sends a `POST` request to `/v2/payment-sessions/{paymentSessionId}/authorizations/x402`
Arguments:
- `payment_session_id`: The unique identifier of the payment session to authorize with x402.
- `payment_signature`: Optional. Base64-encoded (RFC 4648) x402-compliant payment payload.
- `x_customer_display_reference_code`: A short customer-facing reference code for this x402 authorization, visible to the payer. Equivalent to `customerDisplay.referenceCode` on JSON authorization requests. Falls back to the session's `orderCode` when omitted.
- `x_external_reference_id`: An optional merchant-provided internal identifier for this x402 authorization, from the merchant's own system—not visible to the payer.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
```ignore
let response = client.authorize_x402_payment_session()
.payment_session_id(payment_session_id)
.payment_signature(payment_signature)
.x_customer_display_reference_code(x_customer_display_reference_code)
.x_external_reference_id(x_external_reference_id)
.x_idempotency_key(x_idempotency_key)
.send()
.await;
```Get a payment session authorization
Retrieves a single authorization by its ID, including its current status, amount, and any associated onchain transactions.
Sends a `GET` request to `/v2/payment-sessions/{paymentSessionId}/authorizations/{authorizationId}`
Arguments:
- `payment_session_id`: The unique identifier of the payment session.
- `authorization_id`: The unique identifier of the authorization.
```ignore
let response = client.get_payment_session_authorization()
.payment_session_id(payment_session_id)
.authorization_id(authorization_id)
.send()
.await;
```Sourcepub fn cancel_payment_session(&self) -> CancelPaymentSession<'_>
pub fn cancel_payment_session(&self) -> CancelPaymentSession<'_>
Cancel a payment session
Cancels a payment session before any funds have been authorized or captured. The session must be in `created` status. Cancel is blocked while any authorization action is pending.
Once canceled, no further actions can be performed on the session. This is the only way to terminate a pre-authorization session — expiry deadlines block actions but do not automatically transition the session to a terminal state.
Sends a `POST` request to `/v2/payment-sessions/{paymentSessionId}/cancel`
Arguments:
- `payment_session_id`: The unique identifier of the payment session to cancel.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.cancel_payment_session()
.payment_session_id(payment_session_id)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn list_payment_session_captures(&self) -> ListPaymentSessionCaptures<'_>
pub fn list_payment_session_captures(&self) -> ListPaymentSessionCaptures<'_>
List payment session captures
Returns a paginated list of captures for a payment session. Each capture includes its status, amount, associated onchain transactions, and timestamps. Only captures accessible by the current API key are returned.
Sends a `GET` request to `/v2/payment-sessions/{paymentSessionId}/captures`
Arguments:
- `payment_session_id`: The unique identifier of the payment session.
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
```ignore
let response = client.list_payment_session_captures()
.payment_session_id(payment_session_id)
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Sourcepub fn capture_payment_session(&self) -> CapturePaymentSession<'_>
pub fn capture_payment_session(&self) -> CapturePaymentSession<'_>
Capture a payment session
Captures authorized funds. The session must have a positive `capturable` balance and the `captureExpiresAt` deadline must not have passed.
This is an asynchronous operation. The capture is returned in `pending` status and transitions to `succeeded` or `failed`.
Multiple partial captures are allowed. If `amount` is omitted, the full remaining capturable amount is captured.
Sends a `POST` request to `/v2/payment-sessions/{paymentSessionId}/captures`
Arguments:
- `payment_session_id`: The unique identifier of the payment session.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.capture_payment_session()
.payment_session_id(payment_session_id)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn get_payment_session_capture(&self) -> GetPaymentSessionCapture<'_>
pub fn get_payment_session_capture(&self) -> GetPaymentSessionCapture<'_>
Get a payment session capture
Retrieves a single capture by its ID, including status, captured amount, associated onchain transactions, and timestamps. Only returns the capture if the API key has permission to access it.
Sends a `GET` request to `/v2/payment-sessions/{paymentSessionId}/captures/{captureId}`
Arguments:
- `payment_session_id`: The unique identifier of the payment session.
- `capture_id`: The unique identifier of the capture.
```ignore
let response = client.get_payment_session_capture()
.payment_session_id(payment_session_id)
.capture_id(capture_id)
.send()
.await;
```Sourcepub fn list_payment_session_refunds(&self) -> ListPaymentSessionRefunds<'_>
pub fn list_payment_session_refunds(&self) -> ListPaymentSessionRefunds<'_>
List payment session refunds
Returns a paginated list of refunds for a payment session. Each refund includes its status, amount, reason, associated onchain transactions, and timestamps. Only refunds accessible by the current API key are returned.
Sends a `GET` request to `/v2/payment-sessions/{paymentSessionId}/refunds`
Arguments:
- `payment_session_id`: The unique identifier of the payment session.
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
```ignore
let response = client.list_payment_session_refunds()
.payment_session_id(payment_session_id)
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Sourcepub fn refund_payment_session(&self) -> RefundPaymentSession<'_>
pub fn refund_payment_session(&self) -> RefundPaymentSession<'_>
Refund a payment session
Returns captured funds to the payer. The session must have a positive `refundable` balance and the `refundExpiresAt` deadline must not have passed.
This is an asynchronous operation. The refund is returned in `pending` status and transitions to `succeeded` or `failed`.
If `amount` is omitted, the full remaining refundable amount is refunded. Multiple partial refunds are supported.
Sends a `POST` request to `/v2/payment-sessions/{paymentSessionId}/refunds`
Arguments:
- `payment_session_id`: The unique identifier of the payment session.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.refund_payment_session()
.payment_session_id(payment_session_id)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn get_payment_session_refund(&self) -> GetPaymentSessionRefund<'_>
pub fn get_payment_session_refund(&self) -> GetPaymentSessionRefund<'_>
Get a payment session refund
Retrieves a single refund by its ID, including status, refunded amount, reason, associated onchain transactions, and timestamps. Only returns the refund if the API key has permission to access it.
Sends a `GET` request to `/v2/payment-sessions/{paymentSessionId}/refunds/{refundId}`
Arguments:
- `payment_session_id`: The unique identifier of the payment session.
- `refund_id`: The unique identifier of the refund.
```ignore
let response = client.get_payment_session_refund()
.payment_session_id(payment_session_id)
.refund_id(refund_id)
.send()
.await;
```Sourcepub fn list_payment_session_voids(&self) -> ListPaymentSessionVoids<'_>
pub fn list_payment_session_voids(&self) -> ListPaymentSessionVoids<'_>
List payment session voids
Returns a paginated list of voids for a payment session. Each void includes its status, amount, associated onchain transactions, and timestamps. Only voids accessible by the current API key are returned.
Sends a `GET` request to `/v2/payment-sessions/{paymentSessionId}/voids`
Arguments:
- `payment_session_id`: The unique identifier of the payment session.
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
```ignore
let response = client.list_payment_session_voids()
.payment_session_id(payment_session_id)
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Sourcepub fn void_payment_session(&self) -> VoidPaymentSession<'_>
pub fn void_payment_session(&self) -> VoidPaymentSession<'_>
Void a payment session
Releases all remaining capturable funds back to the payer. The session must have a positive `capturable` balance.
This is an asynchronous operation. The void is returned in `pending` status and transitions to `succeeded` or `failed`.
After voiding, no further captures can be made. Unlike **Cancel**, which works before authorization, void works after authorization.
Sends a `POST` request to `/v2/payment-sessions/{paymentSessionId}/voids`
Arguments:
- `payment_session_id`: The unique identifier of the payment session.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.void_payment_session()
.payment_session_id(payment_session_id)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn get_payment_session_void(&self) -> GetPaymentSessionVoid<'_>
pub fn get_payment_session_void(&self) -> GetPaymentSessionVoid<'_>
Get a payment session void
Retrieves a single void by its ID, including status, voided amount, associated onchain transactions, and timestamps. Only returns the void if the API key has permission to access it.
Sends a `GET` request to `/v2/payment-sessions/{paymentSessionId}/voids/{voidId}`
Arguments:
- `payment_session_id`: The unique identifier of the payment session.
- `void_id`: The unique identifier of the void.
```ignore
let response = client.get_payment_session_void()
.payment_session_id(payment_session_id)
.void_id(void_id)
.send()
.await;
```Sourcepub fn list_policies(&self) -> ListPolicies<'_>
pub fn list_policies(&self) -> ListPolicies<'_>
List policies
Lists the policies belonging to the developer's CDP Project. Use the `scope` parameter to filter the policies by scope.
The response is paginated, and by default, returns 20 policies per page.
Sends a `GET` request to `/v2/policy-engine/policies`
Arguments:
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
- `scope`: The scope of the policies to return. If `project`, the response will include exactly one policy, which is the project-level policy. If `account`, the response will include all account-level policies for the developer's CDP Project.
```ignore
let response = client.list_policies()
.page_size(page_size)
.page_token(page_token)
.scope(scope)
.send()
.await;
```Sourcepub fn create_policy(&self) -> CreatePolicy<'_>
pub fn create_policy(&self) -> CreatePolicy<'_>
Create policy
Create a policy that can be used to govern the behavior of accounts.
Sends a `POST` request to `/v2/policy-engine/policies`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.create_policy()
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn get_policy_by_id(&self) -> GetPolicyById<'_>
pub fn get_policy_by_id(&self) -> GetPolicyById<'_>
Get policy by ID
Get a policy by its ID.
Sends a `GET` request to `/v2/policy-engine/policies/{policyId}`
Arguments:
- `policy_id`: The ID of the policy to get.
```ignore
let response = client.get_policy_by_id()
.policy_id(policy_id)
.send()
.await;
```Sourcepub fn update_policy(&self) -> UpdatePolicy<'_>
pub fn update_policy(&self) -> UpdatePolicy<'_>
Update policy
Updates a policy by its ID. This will have the effect of applying the updated policy to all accounts that are currently using it.
Sends a `PUT` request to `/v2/policy-engine/policies/{policyId}`
Arguments:
- `policy_id`: The ID of the policy to update.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.update_policy()
.policy_id(policy_id)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn delete_policy(&self) -> DeletePolicy<'_>
pub fn delete_policy(&self) -> DeletePolicy<'_>
Delete policy
Delete a policy by its ID. This will have the effect of removing the policy from all accounts that are currently using it.
Sends a `DELETE` request to `/v2/policy-engine/policies/{policyId}`
Arguments:
- `policy_id`: The ID of the policy to delete.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
```ignore
let response = client.delete_policy()
.policy_id(policy_id)
.x_idempotency_key(x_idempotency_key)
.send()
.await;
```Sourcepub fn pause_policy(&self) -> PausePolicy<'_>
pub fn pause_policy(&self) -> PausePolicy<'_>
Pause policy
Pause a policy so it is skipped during evaluation as if it were not attached. The policy keeps its ID, scope, and rules. If already paused, this returns the policy with the original pausedAt and replaces resumeAt with the requested time, or clears resumeAt if no time is supplied.
Sends a `POST` request to `/v2/policy-engine/policies/{policyId}/pause`
Arguments:
- `policy_id`: The ID of the policy to pause.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.pause_policy()
.policy_id(policy_id)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn resume_policy(&self) -> ResumePolicy<'_>
pub fn resume_policy(&self) -> ResumePolicy<'_>
Resume policy
Resume a paused policy so its existing ID, scope, and rules are immediately enforced again. Resuming an active policy returns it unchanged.
Sends a `POST` request to `/v2/policy-engine/policies/{policyId}/resume`
Arguments:
- `policy_id`: The ID of the policy to resume.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
```ignore
let response = client.resume_policy()
.policy_id(policy_id)
.x_idempotency_key(x_idempotency_key)
.send()
.await;
```Sourcepub fn simulate_policies(&self) -> SimulatePolicies<'_>
pub fn simulate_policies(&self) -> SimulatePolicies<'_>
Simulate policies
Simulates policy evaluation for one operation against the project's current policies and returns the `action` the real operation would take, the rule that decided it, and the first unmet criterion of every rule that did not match. Nothing is signed, broadcast, or persisted, and gas and nonce are not populated: the transaction is evaluated as submitted.
Each unmet criterion (`observed`) and each matched-rule criterion (`observations`) can include the value observed in the request, with messages and decoded arguments returned up to their documented size limits.
Rate-limiting criteria are read but not consumed. `netUSDChange` criteria run transaction simulation, and pass successfully on testnets, as in the real operation. The result is a snapshot: policies, rate-limit counters, or chain state may change before a real call.
A policy rejection returns `200` with `action: reject`; this endpoint never returns `policy_violation`. A criterion that cannot be evaluated for this input returns `422`.
Sends a `POST` request to `/v2/policy-engine/simulate`
```ignore
let response = client.simulate_policies()
.body(body)
.send()
.await;
```Sourcepub fn list_solana_accounts(&self) -> ListSolanaAccounts<'_>
pub fn list_solana_accounts(&self) -> ListSolanaAccounts<'_>
List Solana accounts
Lists the Solana accounts belonging to the developer.
The response is paginated, and by default, returns 20 accounts per page.
If a name is provided, the response will contain only the account with that name.
Sends a `GET` request to `/v2/solana/accounts`
Arguments:
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
```ignore
let response = client.list_solana_accounts()
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Sourcepub fn create_solana_account(&self) -> CreateSolanaAccount<'_>
pub fn create_solana_account(&self) -> CreateSolanaAccount<'_>
Create Solana account
Creates a new Solana account.
Sends a `POST` request to `/v2/solana/accounts`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.create_solana_account()
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn get_solana_account_by_name(&self) -> GetSolanaAccountByName<'_>
pub fn get_solana_account_by_name(&self) -> GetSolanaAccountByName<'_>
Get Solana account by name
Gets a Solana account by its name.
Sends a `GET` request to `/v2/solana/accounts/by-name/{name}`
Arguments:
- `name`: The name of the Solana account.
```ignore
let response = client.get_solana_account_by_name()
.name(name)
.send()
.await;
```Sourcepub fn export_solana_account_by_name(&self) -> ExportSolanaAccountByName<'_>
pub fn export_solana_account_by_name(&self) -> ExportSolanaAccountByName<'_>
Export Solana account by name
Export an existing Solana account's private key by its name. It is important to store the private key in a secure place after it's exported.
Sends a `POST` request to `/v2/solana/accounts/export/by-name/{name}`
Arguments:
- `name`: The name of the Solana account.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.export_solana_account_by_name()
.name(name)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn import_solana_account(&self) -> ImportSolanaAccount<'_>
pub fn import_solana_account(&self) -> ImportSolanaAccount<'_>
Import Solana account
Import an existing Solana account into the developer's CDP Project. This API should be called from the [CDP SDK](https://github.com/coinbase/cdp-sdk) to ensure that the associated private key is properly encrypted.
Sends a `POST` request to `/v2/solana/accounts/import`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.import_solana_account()
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn send_solana_transaction(&self) -> SendSolanaTransaction<'_>
pub fn send_solana_transaction(&self) -> SendSolanaTransaction<'_>
Send Solana transaction
Signs and sends a single Solana transaction using multiple Solana accounts. The transaction may contain contain several instructions, each of which may require signatures from different account keys.
The transaction should be serialized into a byte array and base64 encoded. The API handles recent blockhash management and fee estimation, leaving the developer to provide only the minimal set of fields necessary to send the transaction.
**Transaction types**
The following transaction types are supported:
* [Legacy transactions](https://solana.com/developers/guides/advanced/versions#current-transaction-versions)
* [Versioned transactions](https://solana.com/developers/guides/advanced/versions)
**Instruction Batching**
To batch multiple operations, include multiple instructions within a single transaction. All instructions within a transaction are executed atomically - if any instruction fails, the entire transaction fails and is rolled back.
**Network Support**
The following Solana networks are supported:
* `solana` - Solana Mainnet
* `solana-devnet` - Solana Devnet
The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
Sends a `POST` request to `/v2/solana/accounts/send/transaction`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.send_solana_transaction()
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn get_solana_account(&self) -> GetSolanaAccount<'_>
pub fn get_solana_account(&self) -> GetSolanaAccount<'_>
Get Solana account by address
Gets a Solana account by its address.
Sends a `GET` request to `/v2/solana/accounts/{address}`
Arguments:
- `address`: The base58 encoded address of the Solana account.
```ignore
let response = client.get_solana_account()
.address(address)
.send()
.await;
```Sourcepub fn update_solana_account(&self) -> UpdateSolanaAccount<'_>
pub fn update_solana_account(&self) -> UpdateSolanaAccount<'_>
Update Solana account
Updates an existing Solana account. Use this to update the account's name or account-level policy.
Sends a `PUT` request to `/v2/solana/accounts/{address}`
Arguments:
- `address`: The base58 encoded address of the Solana account.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.update_solana_account()
.address(address)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn export_solana_account(&self) -> ExportSolanaAccount<'_>
pub fn export_solana_account(&self) -> ExportSolanaAccount<'_>
Export Solana account
Export an existing Solana account's private key. It is important to store the private key in a secure place after it's exported.
Sends a `POST` request to `/v2/solana/accounts/{address}/export`
Arguments:
- `address`: The base58 encoded address of the Solana account.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.export_solana_account()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn sign_solana_message(&self) -> SignSolanaMessage<'_>
pub fn sign_solana_message(&self) -> SignSolanaMessage<'_>
Sign message
Signs an arbitrary message with the given Solana account.
**WARNING:** Never sign a message that you didn't generate, as it can be an arbitrary transaction. For example, it might send all of your funds to an attacker.
Sends a `POST` request to `/v2/solana/accounts/{address}/sign/message`
Arguments:
- `address`: The base58 encoded address of the Solana account.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_solana_message()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn sign_solana_transaction(&self) -> SignSolanaTransaction<'_>
pub fn sign_solana_transaction(&self) -> SignSolanaTransaction<'_>
Sign transaction
Signs a transaction with the given Solana account.
The unsigned transaction should be serialized into a byte array and then encoded as base64.
**Transaction types**
The following transaction types are supported:
* [Legacy transactions](https://solana-labs.github.io/solana-web3.js/classes/Transaction.html)
* [Versioned transactions](https://solana-labs.github.io/solana-web3.js/classes/VersionedTransaction.html)
The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
Sends a `POST` request to `/v2/solana/accounts/{address}/sign/transaction`
Arguments:
- `address`: The base58 encoded address of the Solana account.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `x_wallet_auth`: A JWT signed using your Wallet Secret, encoded in base64. Refer to the
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
section of our Authentication docs for more details on how to generate your Wallet Token.
- `body`
```ignore
let response = client.sign_solana_transaction()
.address(address)
.x_idempotency_key(x_idempotency_key)
.x_wallet_auth(x_wallet_auth)
.body(body)
.send()
.await;
```Sourcepub fn request_solana_faucet(&self) -> RequestSolanaFaucet<'_>
pub fn request_solana_faucet(&self) -> RequestSolanaFaucet<'_>
Request funds on Solana devnet
Request funds from the CDP Faucet on Solana devnet.
Faucets are available for SOL, USDC, and CBTUSD.
To prevent abuse, we enforce rate limits within a rolling 24-hour window to control the amount of funds that can be requested.
These limits are applied at both the CDP Project level and the blockchain address level.
A single blockchain address cannot exceed the specified limits, even if multiple users submit requests to the same address.
| Token | Amount per Faucet Request |Rolling 24-hour window Rate Limits|
|:-----: |:-------------------------:|:--------------------------------:|
| SOL | 0.00125 SOL | 0.0125 SOL |
| USDC | 1 USDC | 10 USDC |
| CBTUSD | 1 CBTUSD | 10 CBTUSD |
Sends a `POST` request to `/v2/solana/faucet`
```ignore
let response = client.request_solana_faucet()
.body(body)
.send()
.await;
```Sourcepub fn list_solana_token_balances(&self) -> ListSolanaTokenBalances<'_>
pub fn list_solana_token_balances(&self) -> ListSolanaTokenBalances<'_>
List Solana token balances
Lists the token balances of a Solana address on a given network. The balances include SPL tokens and the native SOL token. The response is paginated, and by default, returns 20 balances per page.
**Note:** This endpoint is still under development and does not yet provide strong availability or freshness guarantees. Freshness and availability of new token balances will improve over the coming weeks.
Sends a `GET` request to `/v2/solana/token-balances/{network}/{address}`
Arguments:
- `network`: The human-readable network name to get the balances for.
- `address`: The base58 encoded Solana address to get balances for.
- `page_size`: The number of balances to return per page.
- `page_token`: The token for the next page of balances. Will be empty if there are no more balances to fetch.
```ignore
let response = client.list_solana_token_balances()
.network(network)
.address(address)
.page_size(page_size)
.page_token(page_token)
.send()
.await;
```Sourcepub fn create_top_up_link(&self) -> CreateTopUpLink<'_>
pub fn create_top_up_link(&self) -> CreateTopUpLink<'_>
Create a Top-Up Link
Creates a Top-Up Link: a shareable hosted URL that lets a payer add funds to their balance. The resource is immutable once created. The link expires 24 hours after creation and funds a single purchase: once a purchase succeeds, the link is spent and cannot be used again. A purchase that fails does not consume the link, so the payer can retry until it expires. A link is not bound to a specific payer.
Provide `topUpAmount` and `asset`; `orderTotalAmount`, `redirectUrl`, and `customerDisplay` are optional. When `redirectUrl` is supplied, its origin must exactly match one of the entity's configured allowed origins, and the URL must not contain a percent-decoded query key exactly equal to `toppedUpAmount`. The response includes the hosted `topUpUrl` to share with the payer. Creating a link is signaled to webhook subscribers by the `acceptance.top_up_link.created` event, and the purchase that spends the link emits an `acceptance.top_up_link.funds_added` event.
Supply `customerDisplay.merchantName` to override the merchant name on this link's hosted page. The supplied value must not exceed 128 Unicode code points, including surrounding whitespace. Surrounding whitespace is removed before storage. An omitted or empty name after trimming uses the entity's profile name. The create response and creation webhook always return the resolved name stored on the link.
Sends a `POST` request to `/v2/top-up-links`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.create_top_up_link()
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn list_transfers(&self) -> ListTransfers<'_>
pub fn list_transfers(&self) -> ListTransfers<'_>
List transfers
List transfers for your organization. Use this to view and monitor your transfer activity.
**Sorting**: Results are sorted by creation time in descending order (newest first). Transfers with the same creation time are returned in a consistent order across pages.
**Status Filtering**: Filter by specific status to efficiently manage transfers:
* `?status=processing` - Monitor active transfers.
* `?status=quoted` - Find transfers awaiting execution.
* `?status=failed` - Review failed transfers for troubleshooting.
* `?status=completed` - Find completed transfers.
**Account Filtering**: Filter by account ID to find transfers involving a specific account:
* `?accountId=<ID>` - All transfers where the account is either source or target (OR semantics).
* `?sourceAccountId=<ID>` - Only transfers where the account is the source (outbound).
* `?targetAccountId=<ID>` - Only transfers where the account is the target (inbound).
Providing `accountId` together with `sourceAccountId`, `targetAccountId`, `sourceAddress`, `targetAddress`, or `targetEmail` is a validation error and returns HTTP 400.
**Date Range Filtering**: Filter by creation or last-updated time for reconciliation:
* `?createdAfter=2026-01-01T00:00:00Z&createdBefore=2026-01-31T23:59:59Z` - Transfers created within a date range.
* `?updatedAfter=2026-01-01T00:00:00Z` - Transfers updated since a given time. Useful for incremental sync.
**Asset Filtering**: Filter by source or target asset symbol:
* `?sourceAsset=usd` - Transfers funded from a USD account.
* `?targetAsset=usdc` - Transfers delivering USDC to the target.
Supported asset symbols include `usdc`, `eurc`, `usd`, and `eur`.
**Other Filters**:
* `?sourceAddress=0x...` - Transfers from a specific on-chain source address.
* `?targetAddress=0x...` - Transfers to a specific on-chain destination address.
* `?targetEmail=user@example.com` - Transfers to a specific email recipient.
* `?transferId=transfer_...` - Look up a single transfer by ID; bypasses pagination.
**Filter Combinations**: The following combinations are validation errors and return HTTP 400:
* `accountId` with any of `sourceAccountId`, `targetAccountId`, `sourceAddress`, `targetAddress`, or `targetEmail`.
* `sourceAccountId` with `sourceAddress`.
* More than one of `targetAccountId`, `targetAddress`, and `targetEmail`.
* `transferId` with any other filter. Pagination parameters are permitted.
Sends a `GET` request to `/v2/transfers`
Arguments:
- `account_id`: Filter transfers by account ID. Returns transfers where the specified account is either the source or target (OR semantics). Cannot be combined with `sourceAccountId`, `targetAccountId`, `sourceAddress`, `targetAddress`, or `targetEmail`.
- `created_after`: Filter transfers to those created at or after this datetime (inclusive). ISO 8601 format.
- `created_before`: Filter transfers to those created at or before this datetime (inclusive). ISO 8601 format.
- `page_size`: The number of resources to return per page.
- `page_token`: The token for the next page of resources, if any.
- `source_account_id`: Filter transfers by source account ID. Returns only transfers where the specified account is the source. Cannot be combined with `accountId` or `sourceAddress`.
- `source_address`: Filter transfers by the on-chain address of the source. Cannot be combined with `accountId` or `sourceAccountId`.
- `source_asset`: Filter transfers by source asset symbol (e.g., `usd`, `usdc`, `eurc`, `eur`).
- `status`: Filter transfers by status. Useful for building dashboards, monitoring active transfers, or finding transfers needing action.
- `target_account_id`: Filter transfers by target account ID. Returns only transfers where the specified account is the target. Cannot be combined with `accountId`, `targetAddress`, or `targetEmail`.
- `target_address`: Filter transfers by the on-chain destination address of the target. Cannot be combined with `accountId`, `targetAccountId`, or `targetEmail`.
- `target_asset`: Filter transfers by target asset symbol (e.g., `usdc`, `eurc`, `usd`, `eur`).
- `target_email`: Filter transfers by the email address of the target recipient. Cannot be combined with `accountId`, `targetAccountId`, or `targetAddress`.
- `transfer_id`: Filter to a specific transfer by ID. When provided, returns only the matching transfer and bypasses pagination. Cannot be combined with any other filter.
- `updated_after`: Filter transfers to those updated at or after this datetime (inclusive). ISO 8601 format. Useful for incremental sync — poll for transfers that changed state since your last check.
- `updated_before`: Filter transfers to those updated at or before this datetime (inclusive). ISO 8601 format.
```ignore
let response = client.list_transfers()
.account_id(account_id)
.created_after(created_after)
.created_before(created_before)
.page_size(page_size)
.page_token(page_token)
.source_account_id(source_account_id)
.source_address(source_address)
.source_asset(source_asset)
.status(status)
.target_account_id(target_account_id)
.target_address(target_address)
.target_asset(target_asset)
.target_email(target_email)
.transfer_id(transfer_id)
.updated_after(updated_after)
.updated_before(updated_before)
.send()
.await;
```Sourcepub fn create_transfer(&self) -> CreateTransfer<'_>
pub fn create_transfer(&self) -> CreateTransfer<'_>
Create transfer
Create a new transfer to move funds from a source to a target.
All transfers first transition to `quoted`. If `execute: false`, the transfer stays quoted until you call `/v2/transfers/{transferId}/execute`.
If `execute: true`, quoted status emits momentarily before the transfer moves to `processing`, where execution proceeds. Subscribe to the transfers webhook to follow progress in real time instead of polling.
Sends a `POST` request to `/v2/transfers`
Arguments:
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.create_transfer()
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn get_transfer_by_id(&self) -> GetTransferById<'_>
pub fn get_transfer_by_id(&self) -> GetTransferById<'_>
Get transfer
Get a transfer by its ID.
Sends a `GET` request to `/v2/transfers/{transferId}`
Arguments:
- `transfer_id`: The unique identifier of the transfer.
```ignore
let response = client.get_transfer_by_id()
.transfer_id(transfer_id)
.send()
.await;
```Sourcepub fn execute_fund_transfer(&self) -> ExecuteFundTransfer<'_>
pub fn execute_fund_transfer(&self) -> ExecuteFundTransfer<'_>
Execute transfer
Executes a transfer which was created using the Create a transfer endpoint.
Sends a `POST` request to `/v2/transfers/{transferId}/execute`
Arguments:
- `transfer_id`: The ID of the transfer.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
```ignore
let response = client.execute_fund_transfer()
.transfer_id(transfer_id)
.x_idempotency_key(x_idempotency_key)
.send()
.await;
```Sourcepub fn submit_deposit_travel_rule(&self) -> SubmitDepositTravelRule<'_>
pub fn submit_deposit_travel_rule(&self) -> SubmitDepositTravelRule<'_>
Submit deposit travel rule information
Submit travel rule information for a deposit transfer held pending compliance review.
Required fields vary by jurisdiction and may include originator name, address, date of birth, personal ID, and VASP information.
If the submitted information satisfies all jurisdictional requirements, `status` will be `completed` and the transfer will proceed. Otherwise, `status` will be `incomplete` and `missingFields` will indicate which fields still need to be provided.
Sends a `POST` request to `/v2/transfers/{transferId}/travel-rule`
Arguments:
- `transfer_id`: The unique identifier of the transfer.
- `x_idempotency_key`: An optional string request header for making requests safely retryable.
When included, duplicate requests with the same key will return identical responses.
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
- `body`
```ignore
let response = client.submit_deposit_travel_rule()
.transfer_id(transfer_id)
.x_idempotency_key(x_idempotency_key)
.body(body)
.send()
.await;
```Sourcepub fn list_x402_bundles(&self) -> ListX402Bundles<'_>
pub fn list_x402_bundles(&self) -> ListX402Bundles<'_>
List x402 bundles
Lists the available curated x402 workflow bundles. A bundle is an ordered, named grouping of curated x402 resources that together cover a common agent workflow.
The result set is small and server-controlled, so this endpoint is not paginated.
Sends a `GET` request to `/v2/x402/discovery/bundles`
```ignore
let response = client.list_x402_bundles()
.send()
.await;
```Sourcepub fn get_x402_bundle(&self) -> GetX402Bundle<'_>
pub fn get_x402_bundle(&self) -> GetX402Bundle<'_>
Get an x402 bundle
Gets a single curated x402 workflow bundle by its bundle slug, including the bundle metadata and its ordered member resources joined to their full discovery metadata.
Sends a `GET` request to `/v2/x402/discovery/bundles/{bundleSlug}`
Arguments:
- `bundle_slug`: The unique, URL-safe slug identifying the bundle (as returned by `GET /v2/x402/discovery/bundles`).
```ignore
let response = client.get_x402_bundle()
.bundle_slug(bundle_slug)
.send()
.await;
```Sourcepub fn post_x402_discovery_mcp(&self) -> PostX402DiscoveryMcp<'_>
pub fn post_x402_discovery_mcp(&self) -> PostX402DiscoveryMcp<'_>
Handle MCP JSON-RPC request
Handles JSON-RPC requests for the Model Context Protocol (MCP). Supports MCP methods for discovering x402 payment resources and tools.
Sends a `POST` request to `/v2/x402/discovery/mcp`
```ignore
let response = client.post_x402_discovery_mcp()
.body(body)
.send()
.await;
```Sourcepub fn list_x402_discovery_merchant(&self) -> ListX402DiscoveryMerchant<'_>
pub fn list_x402_discovery_merchant(&self) -> ListX402DiscoveryMerchant<'_>
List merchant discovery info
Gets x402 merchant discovery information for a given merchant payment address.
This endpoint returns all active x402 resources associated with the specified `payTo` address, allowing clients to discover what payment-gated resources a merchant exposes and their corresponding payment requirements.
If no active resources are found for the `payTo` address, the endpoint returns an empty `resources` list.
The response is paginated, and by default, returns 20 items per page.
Sends a `GET` request to `/v2/x402/discovery/merchant`
Arguments:
- `limit`: The number of resources to return per page.
- `offset`: The offset of the first resource to return.
- `pay_to`: The merchant's payment address to look up.
This is the onchain address that payment requirements route funds to.
```ignore
let response = client.list_x402_discovery_merchant()
.limit(limit)
.offset(offset)
.pay_to(pay_to)
.send()
.await;
```Sourcepub fn list_x402_discovery_resources(&self) -> ListX402DiscoveryResources<'_>
pub fn list_x402_discovery_resources(&self) -> ListX402DiscoveryResources<'_>
List x402 resources
Lists all active discovered x402 resources.
This endpoint returns resources that have been discovered and cached by the x402 facilitator, including their payment requirements and metadata.
The response is paginated, and by default, returns 100 items per page.
Sends a `GET` request to `/v2/x402/discovery/resources`
Arguments:
- `limit`: The number of discovered x402 resources to return per page.
- `offset`: The offset of the first discovered x402 resource to return.
- `type_`: Filter by protocol type (e.g., "http", "mcp").
Currently, the only supported protocol type is "http".
```ignore
let response = client.list_x402_discovery_resources()
.limit(limit)
.offset(offset)
.type_(type_)
.send()
.await;
```Sourcepub fn search_x402_resources(&self) -> SearchX402Resources<'_>
pub fn search_x402_resources(&self) -> SearchX402Resources<'_>
Search x402 resources
Searches for active x402 resources using a text query and optional filters.
Supports both text-based and vector-based search depending on availability. Results are sorted by relevance and quality score.
Legacy network names (e.g., `base`, `base-sepolia`, `solana`) are automatically normalized to their CAIP-2 equivalents.
The response is limited to 20 items per request. If more results exist, `partialResults` will be `true`.
Sends a `GET` request to `/v2/x402/discovery/search`
Arguments:
- `asset`: Filter results by asset address.
For EVM networks, provide a 0x-prefixed EVM address. For Solana networks, provide a base58-encoded address.
Matching is case-insensitive.
- `bundle_slugs`: Filter results to resources that belong to any of the specified curated bundles (by bundle slug). Can be specified multiple times to filter by multiple bundles; a resource matches if it belongs to at least one of the supplied bundles (OR).
- `curated_only`: When `true`, restrict results to Coinbase-curated resources (those with `curated: true`). When `false` or omitted, both curated and non-curated resources are returned.
- `extensions`: Filter results to resources that support the specified protocol extensions. Can be specified multiple times to filter by multiple extensions.
- `limit`: Maximum number of resources to return. Must be a positive integer no greater than 20.
Defaults to 20.
- `max_usd_price`: Filter results to resources with a USD price at or below this value.
- `network`: Filter results by network in CAIP-2 format (e.g., `eip155:8453`) or legacy name (e.g., `base`, `base-sepolia`, `solana`).
Legacy names are normalized to their CAIP-2 equivalents before filtering.
- `pay_to`: Filter results by the merchant's payment address.
For EVM networks, provide a 0x-prefixed EVM address. For Solana networks, provide a base58-encoded address.
- `query`: Full-text or semantic search query to find matching resources.
- `scheme`: Filter results by payment scheme (e.g., `exact`).
- `tags`: Filter results to resources published with any of the specified provider tags (case-sensitive exact match). Can be specified multiple times to filter by multiple tags; a resource matches if it carries at least one of the supplied tags (OR).
- `url_substring`: Filter results to resources whose URL contains this value (case-insensitive substring match against the resource URL).
Useful for narrowing results to a specific domain, subdomain, or path segment. Combine with `query` to perform semantic search restricted to a URL subset.
Tip: include enough of the URL to disambiguate (e.g. `api.example.com` rather than `example`) — a short substring may also match resources whose path contains the same string.
```ignore
let response = client.search_x402_resources()
.asset(asset)
.bundle_slugs(bundle_slugs)
.curated_only(curated_only)
.extensions(extensions)
.limit(limit)
.max_usd_price(max_usd_price)
.network(network)
.pay_to(pay_to)
.query(query)
.scheme(scheme)
.tags(tags)
.url_substring(url_substring)
.send()
.await;
```Sourcepub fn settle_x402_payment(&self) -> SettleX402Payment<'_>
pub fn settle_x402_payment(&self) -> SettleX402Payment<'_>
Settle payment
Settle an x402 protocol payment with a specific scheme and network.
Sends a `POST` request to `/v2/x402/settle`
```ignore
let response = client.settle_x402_payment()
.body(body)
.send()
.await;
```Sourcepub fn supported_x402_payment_kinds(&self) -> SupportedX402PaymentKinds<'_>
pub fn supported_x402_payment_kinds(&self) -> SupportedX402PaymentKinds<'_>
Get supported payment schemes and networks
Get the supported x402 protocol payment schemes and networks that the facilitator is able to verify and settle payments for.
Sends a `GET` request to `/v2/x402/supported`
```ignore
let response = client.supported_x402_payment_kinds()
.send()
.await;
```Sourcepub fn validate_x402_resource(&self) -> ValidateX402Resource<'_>
pub fn validate_x402_resource(&self) -> ValidateX402Resource<'_>
Validate x402 endpoint
Validates an x402 endpoint's bazaar-discovery configuration by probing the seller's URL live.
Returns a uniform array of preflight check results (reachable, returns402, hasBazaarExtension, parse) and a simulated facilitator accept/reject decision so sellers and agents can confirm their endpoint is ready to be discovered before going live.
This operation is read-only: it performs no payment and does not index the resource.
Sends a `POST` request to `/v2/x402/validate`
```ignore
let response = client.validate_x402_resource()
.body(body)
.send()
.await;
```Sourcepub fn verify_x402_payment(&self) -> VerifyX402Payment<'_>
pub fn verify_x402_payment(&self) -> VerifyX402Payment<'_>
Verify payment
Verify an x402 protocol payment with a specific scheme and network.
Sends a `POST` request to `/v2/x402/verify`
```ignore
let response = client.verify_x402_payment()
.body(body)
.send()
.await;
```Trait Implementations§
Source§impl ClientHooks for &Client
impl ClientHooks for &Client
Source§async fn pre<E>(
&self,
request: &mut Request,
info: &OperationInfo,
) -> Result<(), Error<E>>
async fn pre<E>( &self, request: &mut Request, info: &OperationInfo, ) -> Result<(), Error<E>>
Source§impl ClientInfo<()> for Client
impl ClientInfo<()> for Client
Source§fn api_version() -> &'static str
fn api_version() -> &'static str
Source§fn client(&self) -> &ClientWithMiddleware
fn client(&self) -> &ClientWithMiddleware
reqwest_middleware::ClientWithMiddleware used to make requests.