SDigital2SDigital2
Transactions

Create transaction

Create a new transaction (on-ramp or off-ramp)

POST
/v1/transactions
AuthorizationBearer <token>

In: header

sourceAmount?string

Source amount to convert as string (required when not using exchangeRateId). Values will be truncated to 2 decimal places.

customerIdstring

Customer UUID

Formatuuid
sourceobject

Source payment information

destinationobject

Destination information. For on-ramp transactions (fiat to crypto), include paymentRail and currency. For off-ramp transactions (crypto to fiat), include only bankAccountId.

exchangeRateId?string

Exchange rate ID from the exchange rate API. Can only be provided if sourceAmount is not provided.

purposestring

Purpose of the transaction

Value in"PERSONAL_ACCOUNT" | "INVESTMENT" | "REAL_ESTATE" | "TRADE_TRANSACTIONS" | "TAX" | "LOAN" | "BILLS" | "EXPENSES_REIMBURSEMENT" | "PROFESSIONAL_SERVICES"

Response Body

curl -X POST "https://api.sandbox.sdigital2.com/v1/transactions" \  -H "Content-Type: application/json" \  -d '{    "customerId": "3190d115-987f-402f-b558-0316d3a22ebd",    "source": {      "paymentRail": "ETHEREUM"    },    "destination": {      "paymentRail": "ETHEREUM"    },    "purpose": "INVESTMENT"  }'
{
  "id": "1d59b344-ea39-4e1e-9360-c90486cd9b8e",
  "type": "ON_RAMP",
  "customerId": "1d59b344-ea39-4e1e-9360-c90486cd9b8e",
  "sourceAmount": "100.50",
  "source": {
    "currency": "BRL",
    "paymentRail": "ETHEREUM"
  },
  "destination": {
    "currency": "BRL",
    "paymentRail": "PIX",
    "bankAccountId": "2eeff026-fddb-4649-8f5b-90b27fc2e75e"
  },
  "purpose": "INVESTMENT",
  "createdAt": "2024-01-01T00:00:00.000Z",
  "updatedAt": "2024-01-01T00:00:00.000Z",
  "status": "PENDING",
  "depositInstructions": {
    "paymentRail": "PIX",
    "brCode": "00020126580014br.gov.bcb.pix..."
  },
  "receipt": {
    "sourceCurrency": "USDT",
    "sourceAmount": "100.50",
    "destinationCurrency": "BRL",
    "destinationAmount": "100.50",
    "grossDestinationAmount": "100.50",
    "baseExchangeRate": "1.00",
    "appliedExchangeRate": "1.00",
    "fees": {
      "bps": "10",
      "flatAmount": "1",
      "totalAmount": "11",
      "currency": "USDC"
    }
  }
}
{
  "status": 401,
  "title": "Unauthorized",
  "detail": "Authentication credentials are missing or invalid",
  "code": "UNAUTHORIZED",
  "instance": "/api/v1/transactions",
  "correlationId": "2065cb12-a9fe-42f9-8c75-d63257b3844a"
}
{
  "status": 403,
  "title": "Forbidden",
  "detail": "You do not have permission to access this resource",
  "code": "FORBIDDEN",
  "instance": "/api/v1/transactions",
  "correlationId": "2065cb12-a9fe-42f9-8c75-d63257b3844a"
}
{
  "status": 404,
  "title": "Not Found",
  "detail": "The requested resource could not be found",
  "code": "RESOURCE_NOT_FOUND",
  "instance": "/api/v1/transactions/f133bef1-226c-458a-b6d9-8312edb8d77a",
  "correlationId": "2065cb12-a9fe-42f9-8c75-d63257b3844a"
}
{
  "status": 422,
  "title": "Validation Error",
  "detail": "The request contains invalid data",
  "code": "VALIDATION_ERROR",
  "instance": "/api/v1/transactions",
  "correlationId": "2065cb12-a9fe-42f9-8c75-d63257b3844a",
  "errors": [
    {
      "detail": "sourceAmount must be a positive number",
      "pointer": "/sourceAmount"
    },
    {
      "detail": "destination.currency is required when providing sourceAmount",
      "pointer": "/destination/currency"
    }
  ]
}
{
  "status": 500,
  "title": "Internal Server Error",
  "detail": "An unexpected error occurred while processing your request",
  "code": "INTERNAL_SERVER_ERROR",
  "instance": "/api/v1/transactions",
  "correlationId": "2065cb12-a9fe-42f9-8c75-d63257b3844a"
}