Skip to main content
Convert between USDC and your custom stablecoin using the Prime Conversion API. Conversions are instant, 1:1, and bidirectional — allowing movement between USDC and your custom stablecoin in either direction.
Prime API vs. Stableswapper: This page covers the Prime API path, which operates through Coinbase Prime’s centralized infrastructure. If you need to swap tokens directly onchain (without Prime), see the Stableswapper Quickstart instead.

Prerequisites

  • A Coinbase Prime account with API credentials configured. See the Prime Quickstart for setup instructions.
  • Your portfolio ID and wallet ID. See Wallets for how to retrieve these.

Creating a conversion

Use the Create Conversion endpoint to convert between USDC and your custom stablecoin. Replace CBTUSD with your custom stablecoin symbol.
from prime_sdk.credentials import Credentials
from prime_sdk.client import Client
from prime_sdk.services.transactions import TransactionsService, CreateConversionRequest
import uuid

credentials = Credentials.from_env("PRIME_CREDENTIALS")
client = Client(credentials)
transactions_service = TransactionsService(client)

request = CreateConversionRequest(
    portfolio_id="PORTFOLIO_ID_HERE",
    wallet_id="WALLET_ID_HERE",
    amount='100',
    destination='DESTINATION_WALLET_UUID',
    idempotency_key=str(uuid.uuid4()),
    source_symbol='USDC',
    destination_symbol='CBTUSD',
)

response = transactions_service.create_conversion(request)
For more information, please visit the Prime Python SDK.
For examples in Java, .NET, Go, and CLI, see the Prime Conversions guide.

Tracking a conversion

Use the transaction ID returned by the Create Conversion endpoint to track its status via Get Transaction by ID. Conversions typically reach a terminal state within a few seconds. For code examples on tracking transactions, see the Prime Conversions guide.

Prime Withdrawals

Withdraw converted custom stablecoins to an onchain wallet

Stableswapper Quickstart

Swap tokens directly onchain via the Stableswapper program