🧩 API Integration Guide

Welcome! This guide will walk you through integrating with our API β€” from authentication and setup to placing orders and receiving updates.


πŸ“˜ Table of Contents


1. πŸ›‘οΈ Obtain Credentials

To access the API, you must first obtain your API key and secret. These authenticate your requests and track usage.

πŸ”§ Steps:

  • Contact the Sardine integration team. They will generate a client_id and client_secret for your use.
  • Store both the client_id and client_secret securely.

πŸ” Security Tip: Never expose your secret in frontend apps. Use a backend service to interact with the API.


2. 🌍 Retrieve Supported Geo Coverage, Assets, and Payment Methods

Use the following endpoints to fetch dynamic metadata for your UI:

  • GET /v1/geo-coverage β€” Supported countries/regions.
  • GET /v1/supported-tokens β€” Available cryptocurrencies and fiat currencies.

Use this info to populate dropdowns and validate inputs client-side.


3. πŸ‘€ Onboard a User

Before placing an order, the user must be onboarded and registered in the system.

πŸ“₯ Endpoint

POST /v1/customers

πŸ“¦ Sample Payload

{
  "email": "user@example.com",
  "phone": "+1234567890",
  "country": "US"
}

βœ… Response

Returns a customerId which must be used in all user-specific operations.


4. πŸ”Ž User Verification (KYC)

Depending on jurisdiction or transaction volume, KYC verification may be required.

πŸ› οΈ Endpoint

POST /v1/onramp/customers/{id}/verify

You may be asked to:

  • Upload an ID document.
  • Submit a selfie.
  • Redirect to a hosted KYC flow.

🚦 Response

Returns a verification_status:

  • pending
  • approved
  • rejected

5. πŸ’± Fetch a Quote

Before placing an order, fetch a quote to show the user a guaranteed rate and fee breakdown.

🌐 Endpoint

POST /v1/quotes

πŸ“ Sample Payload

{
  "user_id": "abc123",
  "asset": "BTC",
  "fiat_currency": "USD",
  "amount": "100.00",
  "payment_method": "card"
}

πŸ“Š Response Includes:

  • Exchange rate
  • Fees
  • Quote expiry
  • quote_id (used when placing an order)

6. πŸ›’ Execute an Order

Place an order based on an approved quote.

🌐 Endpoint

POST /v1/orders

πŸ“ Sample Payload

{
  "user_id": "abc123",
  "quote_id": "quote789",
  "payment_method": "card",
  "destination_wallet": {
    "type": "crypto",
    "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
    "asset": "BTC"
  }
}

βœ… Response:

Includes order_id and the initial status.


7. πŸ”” Get Status Updates via Webhooks

Set up webhooks to get real-time updates on order progress and compliance events.

βš™οΈ Steps:

  • Register your webhook URL in the Developer Portal.
  • Your endpoint should be HTTPS and respond with 2xx.

πŸ“¨ Sample Webhook Payload:

{
  "event": "order.status.updated",
  "order_id": "order123",
  "status": "completed",
  "timestamp": "2025-04-17T12:34:56Z"
}

βœ… Validate webhook signatures and implement retry logic for maximum reliability.


8. πŸ” Fetch the Order Status

Poll this endpoint for order updates if webhooks aren’t available or for manual checks.

🌐 Endpoint

GET /v1/orders/{order_id}

πŸ“€ Response Includes:

  • Current status: pending, processing, completed, failed
  • Timestamps
  • Payment and asset transfer details

βœ… You’re All Set!

Once these steps are implemented, you’ll have full integration from onboarding to real-time tracking. For additional topics like error handling, retries, or sandbox mode, check out the Extended Developer Docs.