@@ -25,7 +25,24 @@ Grid enables seamless conversion between fiat currencies and cryptocurrencies vi
2525
2626### Create a quote
2727
28- <CodeGroup >
28+ First, create an external account for the crypto destination:
29+
30+ ``` bash cURL
31+ curl -X POST ' https://api.lightspark.com/grid/2025-10-13/customers/external-accounts' \
32+ -H ' Authorization: Basic $GRID_CLIENT_ID:$GRID_CLIENT_SECRET' \
33+ -H ' Content-Type: application/json' \
34+ -d ' {
35+ "customerId": "Customer:019542f5-b3e7-1d02-0000-000000000001",
36+ "currency": "BTC",
37+ "accountInfo": {
38+ "accountType": "SPARK_WALLET",
39+ "address": "spark1pgssyuuuhnrrdjswal5c3s3rafw9w3y5dd4cjy3duxlf7hjzkp0rqx6dj6mrhu"
40+ }
41+ }'
42+ ```
43+
44+ Then create a quote using the external account ID:
45+
2946``` bash cURL
3047curl -X POST ' https://api.lightspark.com/grid/2025-10-13/quotes' \
3148 -H ' Authorization: Basic $GRID_CLIENT_ID:$GRID_CLIENT_SECRET' \
@@ -36,63 +53,15 @@ curl -X POST 'https://api.lightspark.com/grid/2025-10-13/quotes' \
3653 "currency": "USD"
3754 },
3855 "destination": {
39- "externalAccountDetails": {
40- "customerId": "Customer:019542f5-b3e7-1d02-0000-000000000001",
41- "currency": "BTC",
42- "beneficiary": {
43- "counterPartyType": "INDIVIDUAL",
44- "fullName": "John Doe",
45- "email": "john@example.com"
46- },
47- "accountInfo": {
48- "accountType": "SPARK_WALLET",
49- "address": "spark1pgssyuuuhnrrdjswal5c3s3rafw9w3y5dd4cjy3duxlf7hjzkp0rqx6dj6mrhu"
50- }
51- }
56+ "destinationType": "ACCOUNT",
57+ "accountId": "ExternalAccount:b23dcbd6-dced-4ec4-b756-3c3a9ea3d456"
5258 },
5359 "lockedCurrencySide": "RECEIVING",
5460 "lockedCurrencyAmount": 100000,
5561 "description": "Buy 0.001 BTC"
5662 }'
5763```
5864
59- ``` javascript Node.js
60- const quote = await fetch (" https://api.lightspark.com/grid/2025-10-13/quotes" , {
61- method: " POST" ,
62- headers: {
63- Authorization: ` Basic ${ credentials} ` ,
64- " Content-Type" : " application/json" ,
65- },
66- body: JSON .stringify ({
67- source: {
68- customerId: " Customer:019542f5-b3e7-1d02-0000-000000000001" ,
69- currency: " USD" ,
70- },
71- destination: {
72- externalAccountDetails: {
73- customerId: " Customer:019542f5-b3e7-1d02-0000-000000000001" ,
74- currency: " BTC" ,
75- beneficiary: {
76- counterPartyType: " INDIVIDUAL" ,
77- fullName: " John Doe" ,
78- email: " john@example.com" ,
79- },
80- accountInfo: {
81- accountType: " SPARK_WALLET" ,
82- address:
83- " spark1pgssyuuuhnrrdjswal5c3s3rafw9w3y5dd4cjy3duxlf7hjzkp0rqx6dj6mrhu" ,
84- },
85- },
86- },
87- lockedCurrencySide: " RECEIVING" ,
88- lockedCurrencyAmount: 100000 , // 0.001 BTC in satoshis
89- description: " Buy 0.001 BTC" ,
90- }),
91- }).then ((r ) => r .json ());
92- ```
93-
94- </CodeGroup >
95-
9665** Response includes payment instructions:**
9766
9867``` json
@@ -212,30 +181,23 @@ app.post("/webhooks/grid", async (req, res) => {
212181
213182For instant on-ramps (e.g., reward payouts), use ` immediatelyExecute: true ` with an internal account source:
214183
215- ``` javascript
216- const quote = await fetch (" https://api.lightspark.com/grid/2025-10-13/quotes" , {
217- method: " POST" ,
218- body: JSON .stringify ({
219- source: {
220- sourceType: " ACCOUNT" ,
221- accountId: " InternalAccount:a12dcbd6-dced-4ec4-b756-3c3a9ea3d123" ,
184+ ``` bash cURL
185+ curl -X POST ' https://api.lightspark.com/grid/2025-10-13/quotes' \
186+ -H ' Authorization: Basic $GRID_CLIENT_ID:$GRID_CLIENT_SECRET' \
187+ -H ' Content-Type: application/json' \
188+ -d ' {
189+ "source": {
190+ "sourceType": "ACCOUNT",
191+ "accountId": "InternalAccount:a12dcbd6-dced-4ec4-b756-3c3a9ea3d123"
222192 },
223- destination: {
224- destinationType: " EXTERNAL_ACCOUNT_DETAILS" ,
225- externalAccountDetails: {
226- customerId: " Customer:..." ,
227- currency: " BTC" ,
228- accountInfo: {
229- accountType: " SPARK_WALLET" ,
230- address: " spark1..." ,
231- },
232- },
193+ "destination": {
194+ "destinationType": "ACCOUNT",
195+ "accountId": "ExternalAccount:b23dcbd6-dced-4ec4-b756-3c3a9ea3d456"
233196 },
234- lockedCurrencySide: " RECEIVING" ,
235- lockedCurrencyAmount: 100000 ,
236- immediatelyExecute: true ,
237- }),
238- }).then ((r ) => r .json ());
197+ "lockedCurrencySide": "RECEIVING",
198+ "lockedCurrencyAmount": 100000,
199+ "immediatelyExecute": true
200+ }'
239201```
240202
241203<Info >
0 commit comments