Swap
This documentation explains how to use our Swap API for converting USD to ETB (Ethiopian Birr).
Initiating a Swap
Endpoint: https://api.chapa.co/v1/swap
Method: POST
Authorization
: Pass your secret key as a bearer token in the request header to authorize this call.
Body Parameters
Parameter | Required | Type | Description |
---|---|---|---|
amount | yes | number | The amount to convert (minimum 1 USD) |
from | yes | string | Source currency code (USD) |
to | yes | string | Target currency code (ETB) |
Important Notes
- The minimum amount for conversion is 1 USD
- Current exchange rate is applied at the time of the swap
- Swaps are processed immediately and cannot be reversed
- The maximum allowed amount for swap is $10,000
- The exchanged amount will be added to the business ETB balance
1import requests2 import json3 4 url = "https://api.chapa.co/v1/swap"5 6 payload = json.dumps({7 "amount": 100,8 "from": "USD",9 "to": "ETB"10 })11 headers = {12 'Content-Type': 'application/json',13 'Authorization': 'Bearer CHASECK_TEST-xxxxxxxxxxxxxxxx'14 }15 16 response = requests.request("POST", url, headers=headers, data=payload)17 18 print(response.text)
ℹ️
Refer to our Error Codes page for all responses for this request.