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 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.
Authorizations
A JWT signed using your CDP API Key Secret, encoded in base64. Refer to the Generate Bearer Token section of our Authentication docs for information on how to generate your Bearer Token.
Body
Common request parameters shared by Create Onramp Session and Create Onramp Mobile Challenge.
The ticker (e.g. BTC, USDC, SOL) or the Coinbase UUID (e.g. d85dce9b-5b73-5c3c-8978-522ce1d1c1b4) of the crypto asset to be purchased.
Use the Onramp Buy Options API to discover the supported purchase currencies for your user's location.
"USDC"
The name of the crypto network the purchased currency will be sent on.
Use the Onramp Buy Options API to discover the supported networks for your user's location.
"base"
The address the purchased crypto will be sent to.
1 - 128"0x1234567890abcdef1234567890abcdef12345678"
URI to redirect the user to after they complete or dismiss the transaction. Embedded in the returned onramp URL as a query parameter.
5 - 2048^.*://.*$"https://example.com/success"
A string representing the amount of fiat the user wishes to pay in exchange for crypto. When using this parameter, the returned quote will be inclusive of fees i.e. the user will pay this exact amount of the payment currency.
"100.00"
A string representing the amount of crypto the user wishes to purchase. When using this parameter, the returned quote will be exclusive of fees i.e. the user will receive this exact amount of the purchase currency.
"10.000000"
The fiat currency to be converted to crypto.
"USD"
The type of payment method used to generate the onramp quote.
CARD, ACH, APPLE_PAY, PAYPAL, FIAT_WALLET, CRYPTO_WALLET "CARD"
The ISO 3166-1 two letter country code (e.g. US).
"US"
The ISO 3166-2 two letter state code (e.g. NY). Only required for US.
"NY"
The IP address of the end user requesting the onramp transaction.
"127.0.0.1"
A unique string that represents the user in your app. This can be used to link individual transactions together so you can retrieve the transaction history for your users. Prefix this string with "sandbox-" (e.g. "sandbox-user-1234") to perform a sandbox transaction which will allow you to test your integration without any real transfer of funds.
This value can be used with the Onramp User Transactions API to retrieve all transactions created by the user.
"user-1234"
Response
Onramp mobile challenge created successfully.
A server-issued challenge for platform attestation in an App2App onramp handoff.
An opaque server-issued token to be used with platform attestation (iOS App Attest or Android Play Integrity Standard). Treat it as an opaque string — do not attempt to parse its contents. Pass this value along with the attestation payload to the Create Onramp Mobile Session endpoint to complete the App2App handoff.
iOS: pass this value directly to DCAppAttestService.generateAssertion(keyId, clientDataHash: SHA256(challenge)).
Android: compute requestHash = base64url(SHA256(challenge)) and pass it to StandardIntegrityManager.requestToken(requestHash).
16 - 2048"MWYwNWQwODktZTZlYy02OTdlLTgzZTYtMTI3NzcyOWJhNjM3"
The time at which the challenge expires. Challenges are short-lived; submit the attestation to Create Onramp Mobile Session before this time or request a new challenge.
"2025-04-24T00:05:00Z"