### Request a Quote using SideShift.ai API Source: https://docs.sideshift.ai/api-intro/getting-started Example using cURL to request a quote for a cryptocurrency shift. This involves specifying deposit and settlement coins/networks, amounts, and affiliate ID. The response contains a quote ID necessary for creating a shift. ```bash curl -L 'https://sideshift.ai/api/v2/quotes' \ -H 'Content-Type: application/json' \ -H 'x-sideshift-secret: $SIDESHIFT_SECRET' \ -d '{ \ "depositCoin": "eth", \ "depositNetwork": "arbitrum", \ "settleCoin": "eth", \ "settleNetwork": "mainnet", \ "depositAmount": "0.14364577", \ "settleAmount": null, \ "affiliateId": "$AFFILIATE_ID" \ }' ``` -------------------------------- ### Create a Fixed Shift using SideShift.ai API Source: https://docs.sideshift.ai/api-intro/getting-started Example using cURL to create a fixed shift after obtaining a quote. This requires the settlement address, affiliate ID, and the quote ID obtained from the previous step. The API returns a deposit address for the user and allows monitoring the shift status via the shift ID. ```bash curl -L 'https://sideshift.ai/api/v2/shifts/fixed' \ -H 'Content-Type: application/json' \ -H 'x-sideshift-secret: $SIDESHIFT_SECRET' \ -d '{ \ "settleAddress": "0xde2642b2120fd3011fe9659688f76e9E4676F472", \ "affiliateId": "$AFFILIATE_ID", \ "quoteId": "QUOTE_ID" \ }' ``` -------------------------------- ### Environment Variables for SideShift.ai API Source: https://docs.sideshift.ai/api-intro/getting-started Configuration for SideShift.ai API credentials, including the secret key and affiliate ID, typically stored in a .env file. ```env SIDESHIFT_SECRET=7c9c7e02b9281fe34df3daf98425421f AFFILIATE_ID=YQMi62XMb ``` -------------------------------- ### Sideshift AI REST API Introduction Source: https://docs.sideshift.ai/faq Provides an overview of the Sideshift AI REST API, including getting started information and links to specific endpoints. ```APIDOC REST API: - Introduction: https://docs.sideshift.ai/api-intro/getting-started - Endpoints: https://docs.sideshift.ai/endpoints/endpoints-intro - New checkout API endpoints released. ``` -------------------------------- ### SideShift.ai API Endpoints Overview Source: https://docs.sideshift.ai/api-intro/getting-started Documentation for key SideShift.ai API endpoints related to shifts and quotes. Includes details on creating shifts, retrieving shift status, and managing quotes. ```APIDOC API Endpoints: POST /api/v2/quotes Description: Requests a quote for a cryptocurrency shift. Headers: Content-Type: application/json x-sideshift-secret: Your private key. Body: depositCoin: The cryptocurrency to deposit (e.g., 'eth'). depositNetwork: The network for the deposit (e.g., 'arbitrum'). settleCoin: The cryptocurrency to settle with (e.g., 'eth'). settleNetwork: The network for the settlement (e.g., 'mainnet'). depositAmount: The amount to deposit. settleAmount: The amount to settle (can be null if depositAmount is provided). affiliateId: Your affiliate ID. Returns: {"id": "QUOTE_ID", ...} POST /api/v2/shifts/fixed Description: Creates a fixed shift. Headers: Content-Type: application/json x-sideshift-secret: Your private key. Body: settleAddress: The address where the settled coins should be sent. affiliateId: Your affiliate ID. quoteId: The ID obtained from the /quotes endpoint. Returns: {"depositAddress": "...", "shiftId": "...", ...} GET /v2/shifts/{shiftId} Description: Retrieves the status of a specific shift. Parameters: shiftId: The ID of the shift to query. Returns: Shift status details (e.g., pending, completed, failed). ``` -------------------------------- ### Environment Variables Setup Source: https://docs.sideshift.ai/api-intro/shift-integration-guide Sets up essential environment variables for interacting with the SideShift AI API. Includes sensitive data like private keys and API base URLs. It's crucial to keep the private key secure. ```bash SIDESHIFT_SECRET=your_account_private_key AFFILIATE_ID=your_affiliate_id API_BASE_URL=https://sideshift.ai/api/v2 ``` -------------------------------- ### Fetch Pairs (Go) Source: https://docs.sideshift.ai/endpoints/v2/pairs Example of how to fetch cryptocurrency pair information using Go. This code snippet demonstrates making a GET request to the /api/v2/pairs endpoint. ```go // Go example for fetching pairs would go here. ``` -------------------------------- ### Basic HTML Template Source: https://docs.sideshift.ai/widget-integration-guide-one A fundamental HTML5 template used as a starting point for the widget integration. It includes the basic structure of an HTML document with head and body sections. ```html SideShift Widget Integration Demo ``` -------------------------------- ### Go Request Example Source: https://docs.sideshift.ai/endpoints/v2/checkout Example of how to fetch checkout data using Go's net/http package. ```go // Go example would go here, typically using the 'net/http' package. // package main // // import ( // "fmt" // "io/ioutil" // "net/http" // ) // // func main() { // checkoutID := "YOUR_CHECKOUT_ID" // url := fmt.Sprintf("https://sideshift.ai/api/v2/checkout/%s", checkoutID) // // req, err := http.NewRequest("GET", url, nil) // if err != nil { // fmt.Printf("Error creating request: %v\n", err) // return // } // req.Header.Set("Accept", "application/json") // // client := &http.Client{} // resp, err := client.Do(req) // if err != nil { // fmt.Printf("Error sending request: %v\n", err) // return // } // defer resp.Body.Close() // // body, err := ioutil.ReadAll(resp.Body) // if err != nil { // fmt.Printf("Error reading response body: %v\n", err) // return // } // // fmt.Println(string(body)) // } ``` -------------------------------- ### PowerShell Request Example Source: https://docs.sideshift.ai/endpoints/v2/checkout Example of how to fetch checkout data using PowerShell. ```powershell # PowerShell example would go here. # $checkoutId = "YOUR_CHECKOUT_ID" # $url = "https://sideshift.ai/api/v2/checkout/$checkoutId" # # Invoke-RestMethod -Uri $url -Method Get -Headers @{"Accept"="application/json"} ``` -------------------------------- ### Fetch Coins (Java) Source: https://docs.sideshift.ai/endpoints/v2/coins A Java example for fetching coin information using `java.net.http.HttpClient`. This code demonstrates making an HTTP GET request and handling the response. ```java import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; public class CoinFetcher { public static void main(String[] args) { HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://sideshift.ai/api/v2/coins")) .build(); client.sendAsync(request, HttpResponse.BodyHandlers.ofString()) .thenApply(HttpResponse::body) .thenAccept(System.out::println) .join(); } } ``` -------------------------------- ### Fetch Pairs (C#) Source: https://docs.sideshift.ai/endpoints/v2/pairs Example of how to fetch cryptocurrency pair information using C#. This code snippet demonstrates making a GET request to the /api/v2/pairs endpoint. ```csharp // C# example for fetching pairs would go here. ``` -------------------------------- ### C# Request Example Source: https://docs.sideshift.ai/endpoints/v2/checkout Example of how to fetch checkout data using C# HttpClient. ```csharp // C# example would go here, typically using System.Net.Http.HttpClient. // using System; // using System.Net.Http; // using System.Threading.Tasks; // // public class CheckoutClient // { // public static async Task GetCheckoutAsync(string checkoutId) // { // using (var client = new HttpClient()) // { // client.BaseAddress = new Uri("https://sideshift.ai/api/v2/"); // client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); // // HttpResponseMessage response = await client.GetAsync($"checkout/{checkoutId}"); // response.EnsureSuccessStatusCode(); // Throw if HTTP status code is not 2xx // // string responseBody = await response.Content.ReadAsStringAsync(); // Console.WriteLine(responseBody); // } // } // // // Example usage: // // public static void Main(string[] args) // // { // // GetCheckoutAsync("YOUR_CHECKOUT_ID").Wait(); // // } // } ``` -------------------------------- ### Create Fixed Shift API Source: https://docs.sideshift.ai/api-intro/shift-integration-guide Details the process of creating a fixed rate shift after obtaining a quote. Requires the `quoteId` and matching `affiliateId`. The endpoint facilitates the actual currency exchange setup. ```APIDOC POST /v2/shifts/fixed Headers: x-sideshift-secret: ACCOUNT_PRIVATE_KEY x-user-ip: END_USER_IP_ADDRESS Body: { "settleAddress": "SETTLE_ADDRESS", "affiliateId": "ACCOUNT_AFFILIATE_ID", "quoteId": "QUOTE_ID" } Notes: - Validate quote hasn't expired. - Implement proper error handling. - Start status monitoring after creation. ``` -------------------------------- ### Ruby Request Example Source: https://docs.sideshift.ai/endpoints/v2/checkout Example of how to fetch checkout data using Ruby's Net::HTTP. ```ruby # Ruby example would go here, typically using the 'net/http' library. # require 'net/http' # require 'uri' # # checkout_id = 'YOUR_CHECKOUT_ID' # uri = URI.parse("https://sideshift.ai/api/v2/checkout/#{checkout_id}") # # Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http| # request = Net::HTTP::Get.new(uri) # request['Accept'] = 'application/json' # # response = http.request(request) # puts response.body # end ``` -------------------------------- ### Java Request Example Source: https://docs.sideshift.ai/endpoints/v2/checkout Example of how to fetch checkout data using Java's HttpClient. ```java // Java example would go here, typically using java.net.http.HttpClient (Java 11+). // import java.net.URI; // import java.net.http.HttpClient; // import java.net.http.HttpRequest; // import java.net.http.HttpResponse; // // public class CheckoutClient { // // public static void main(String[] args) { // String checkoutId = "YOUR_CHECKOUT_ID"; // HttpClient client = HttpClient.newHttpClient(); // HttpRequest request = HttpRequest.newBuilder() // .uri(URI.create("https://sideshift.ai/api/v2/checkout/" + checkoutId)) // .header("Accept", "application/json") // .build(); // // client.sendAsync(request, HttpResponse.BodyHandlers.ofString()) // .thenApply(HttpResponse::body) // .thenAccept(System.out::println) // .join(); // } // } ``` -------------------------------- ### Node.js Request Example Source: https://docs.sideshift.ai/endpoints/v2/checkout Example of how to fetch checkout data using Node.js. ```nodejs // Node.js example would go here, typically using 'node-fetch' or the built-in 'https' module. // const fetch = require('node-fetch'); // const checkoutId = 'YOUR_CHECKOUT_ID'; // const url = `https://sideshift.ai/api/v2/checkout/${checkoutId}`; // // async function getCheckout() { // try { // const response = await fetch(url, { // method: 'GET', // headers: { // 'Accept': 'application/json' // } // }); // const data = await response.json(); // console.log(data); // } catch (error) { // console.error('Error fetching checkout:', error); // } // } // // getCheckout(); ``` -------------------------------- ### Fetch Coins (C#) Source: https://docs.sideshift.ai/endpoints/v2/coins A C# example demonstrating how to retrieve coin data using `HttpClient`. This code snippet illustrates making an asynchronous GET request and processing the JSON response. ```csharp using System; using System.Net.Http; using System.Threading.Tasks; public class CoinFetcher { public static async Task FetchCoinsAsync() { using (HttpClient client = new HttpClient()) { try { HttpResponseMessage response = await client.GetAsync("https://sideshift.ai/api/v2/coins"); response.EnsureSuccessStatusCode(); // Throw if not 2xx string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Request error: {e.Message}"); } } } public static void Main(string[] args) { FetchCoinsAsync().Wait(); } } ``` -------------------------------- ### Python Request Example Source: https://docs.sideshift.ai/endpoints/v2/checkout Example of how to fetch checkout data using Python's requests library. ```python # Python example would go here, typically using the 'requests' library. # import requests # checkout_id = "YOUR_CHECKOUT_ID" # url = f"https://sideshift.ai/api/v2/checkout/{checkout_id}" # headers = { # "Accept": "application/json" # } # response = requests.get(url, headers=headers) # print(response.json()) ``` -------------------------------- ### SideShift AI API - Create Checkout Example (cURL) Source: https://docs.sideshift.ai/endpoints/v2/createcheckout Example cURL command to create a checkout with SideShift AI. It demonstrates how to set the Content-Type and Accept headers, and provides a JSON payload with the necessary checkout details. ```curl curl -L 'https://sideshift.ai/api/v2/checkout' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -d '{ \ "settleCoin": "eth", \ "settleNetwork": "mainnet", \ "settleAmount": "0.01", \ "settleAddress": "0x0123456789B57d85F8BccCFf3fE3cf5a74E97b73", \ "affiliateId": "YQMi62XMb", \ "successUrl": "https://example.com/success", \ "cancelUrl": "https://example.com/cancel" \ }' ``` -------------------------------- ### Example cURL Request Source: https://docs.sideshift.ai/endpoints/v1/createorder-fixed This example demonstrates how to make a POST request to the SideShift.ai API to create a fixed-rate order using cURL. ```curl curl -L 'https://sideshift.ai/api/v1/orders' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json; charset=utf-8' \ -H 'x-sideshift-secret: YOUR_SECRET_KEY' \ -d '{ \ "type": "fixed", \ "quoteId": "459abd73-71cd-40ac-b4b0-58b90386ce53", \ "settleAddress": "MRHrYyu9H5dFXvqHcUMfY3h7Nsyt1dhR5T", \ "affiliateId": "YQMi62XMb", \ "refundAddress": "19dENFt4wVwos6xtgwStA6n8bbA57WCS58" \ }' ``` -------------------------------- ### Create Directory and Navigate Source: https://docs.sideshift.ai/widget-integration-guide-one This snippet demonstrates the bash commands to create a new directory for the SideShift widget demo and then navigate into that directory. These are the initial steps for setting up the project environment. ```bash mkdir sideshift-widget-demo cd sideshift-widget-demo ``` -------------------------------- ### Fetch Pairs (cURL) Source: https://docs.sideshift.ai/endpoints/v2/pairs Example of how to fetch cryptocurrency pair information using cURL. This command demonstrates the GET request to the /api/v2/pairs endpoint. ```curl curl -L 'https://sideshift.ai/api/v2/pairs' ``` -------------------------------- ### Fetch Pairs (Java) Source: https://docs.sideshift.ai/endpoints/v2/pairs Example of how to fetch cryptocurrency pair information using Java. This code snippet shows how to make a GET request to the /api/v2/pairs endpoint. ```java // Java example for fetching pairs would go here. ``` -------------------------------- ### Test SideShift Widget Locally Source: https://docs.sideshift.ai/widget-integration-guide-one Command to open the HTML file locally to test the SideShift widget integration. This allows you to verify the widget functions as expected after implementation. ```bash open index.html ``` -------------------------------- ### Fetch Pairs (Node.js) Source: https://docs.sideshift.ai/endpoints/v2/pairs Example of how to fetch cryptocurrency pair information using Node.js. This code snippet illustrates making a GET request to the /api/v2/pairs endpoint. ```nodejs // Node.js example for fetching pairs would go here. ``` -------------------------------- ### Fetch Pairs (Ruby) Source: https://docs.sideshift.ai/endpoints/v2/pairs Example of how to fetch cryptocurrency pair information using Ruby. This code snippet shows how to make a GET request to the /api/v2/pairs endpoint. ```ruby # Ruby example for fetching pairs would go here. ``` -------------------------------- ### Test Local Integration Source: https://docs.sideshift.ai/widget-integration-guide-two This command initiates the local development server to test the SideShift widget integration. After running, the widget should appear and function when the 'Shift with SideShift' button is clicked. ```bash npm run dev ``` -------------------------------- ### Fetch Pairs (PowerShell) Source: https://docs.sideshift.ai/endpoints/v2/pairs Example of how to fetch cryptocurrency pair information using PowerShell. This code snippet demonstrates making a GET request to the /api/v2/pairs endpoint. ```powershell # PowerShell example for fetching pairs would go here. ``` -------------------------------- ### SideShift Widget Initialization Source: https://docs.sideshift.ai/widget This script configures the SideShift widget with essential parameters like affiliate ID, default payment methods, and theme. It should be placed in the website's `` section. ```javascript window.__SIDESHIFT__={ parentAffiliateId:"k0Kx8oXzy", defaultDepositMethodId:"btc", defaultSettleMethodId:"eth", settleAddress:undefined, type:"variable", settleAmount:undefined, theme:"dark", }; ``` -------------------------------- ### Fetch Pairs (PHP) Source: https://docs.sideshift.ai/endpoints/v2/pairs Example of how to fetch cryptocurrency pair information using PHP. This code snippet illustrates making a GET request to the /api/v2/pairs endpoint. ```php // PHP example for fetching pairs would go here. ``` -------------------------------- ### SideShift.ai API Endpoints Source: https://docs.sideshift.ai/api-intro/shift-integration-guide Provides an overview of key SideShift.ai API endpoints for integration, including creating variable shifts, monitoring shift status, checking user permissions, and managing refund addresses. ```APIDOC API Endpoints: 1. Create Variable Shift: - Endpoint: POST /v2/shifts/variable - Description: Creates a variable shift with specified deposit and settlement details. - Headers: x-sideshift-secret (required), x-user-ip (optional, for server-side requests) - Request Body: - settleAddress: string (required) - affiliateId: string (required) - depositCoin: string (required) - depositNetwork: string (required) - settleCoin: string (required) - settleNetwork: string (required) - refundAddress: string (optional) - refundMemo: string (optional) 2. Monitor Shift Status: - Endpoint: GET /v2/shift - Description: Polls the status of a shift. Requires shift ID. - Parameters: shiftId (required) 3. Check User Permissions: - Endpoint: GET /v2/permissions - Description: Determines if the user is allowed to use SideShift.ai. 4. Set Refund Address: - Endpoint: PUT /v2/shifts/{shiftId}/set-refund-address - Description: Sets the refund address for a shift that is in a 'refund' status. - Parameters: - shiftId: string (required) - Request Body: - refundAddress: string (required) - refundMemo: string (optional) 5. Get Coin Information: - Endpoint: GET /v2/coins - Description: Retrieves information about supported coins and networks, including memo requirements. ``` -------------------------------- ### Sideshift AI Troubleshooting and FAQ Source: https://docs.sideshift.ai/faq Resources for troubleshooting common errors and frequently asked questions for Sideshift AI. ```APIDOC Troubleshoot Errors: - https://docs.sideshift.ai/troubleshoot-errors FAQ: - https://docs.sideshift.ai/faq ``` -------------------------------- ### SideShift Widget Configuration and Button Integration Source: https://docs.sideshift.ai/widget-integration-guide-one This snippet shows how to configure the SideShift widget with your affiliate ID, default deposit/settlement methods, and theme. It also includes the HTML structure for the button that triggers the widget. ```html SideShift Widget Integration Demo

Click on the button to open the SideShift Widget

This is a demo of the embeddable SideShift Widget and Button. For more info, visit https://sideshift.ai/embed.

``` -------------------------------- ### Create React App with Vite Source: https://docs.sideshift.ai/widget-integration-guide-two Command to create a new React application using Vite with TypeScript template. ```bash npm create vite@latest sideshift-widget-demo --template react-ts ``` -------------------------------- ### Fetch Coins (Node.js) Source: https://docs.sideshift.ai/endpoints/v2/coins An example using Node.js to fetch coin data. This snippet demonstrates making an HTTP GET request and handling the JSON response. ```nodejs const https = require('https'); https.get('https://sideshift.ai/api/v2/coins', (res) => { let data = ''; res.on('data', (chunk) => { data += chunk; }); res.on('end', () => { console.log(JSON.parse(data)); }); }).on('error', (err) => { console.error('Error:', err); }); ``` -------------------------------- ### Fetch Pairs (Python) Source: https://docs.sideshift.ai/endpoints/v2/pairs Example of how to fetch cryptocurrency pair information using Python's requests library. This code snippet shows how to make a GET request to the /api/v2/pairs endpoint. ```python # Python example for fetching pairs would go here. ``` -------------------------------- ### cURL Request Example for Pair Endpoint Source: https://docs.sideshift.ai/endpoints/v2/pair Demonstrates how to make a GET request to the SideShift AI API v2 Pair endpoint using cURL. This includes specifying the 'from' and 'to' path parameters and required headers. ```curl curl -L 'https://sideshift.ai/api/v2/pair/:from/:to' ``` -------------------------------- ### Fetch Coins (Go) Source: https://docs.sideshift.ai/endpoints/v2/coins Provides a Go language example for fetching coin information from the SideShift.ai API. It utilizes the standard `net/http` package for making the request. ```go package main import ( "fmt" "io/ioutil" "net/http" ) func main() { resp, err := http.Get("https://sideshift.ai/api/v2/coins") if err != nil { fmt.Printf("Error making request: %s\n", err) return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Printf("Error reading response body: %s\n", err) return } fmt.Println(string(body)) } ``` -------------------------------- ### SideShift Widget Embed Code Source: https://docs.sideshift.ai/widget-integration-guide-one This snippet shows how to embed the SideShift widget into an HTML file. It includes the necessary JavaScript configuration object (`window.__SIDESHIFT__`) with customizable options like affiliate ID, deposit/settle methods, and theme, along with the script to load the widget. ```html SideShift Widget Integration Demo window.__SIDESHIFT__={ parentAffiliateId:"k0Kx8oXzy",// Replace with your SideShift.ai account ID defaultDepositMethodId:"btc",// Replace with your chosen default deposit method defaultSettleMethodId:"eth",// Replace with your chosen default settlement method settleAddress:undefined,// Replace with the recipient address if needed type:"variable",// Type of shift: variable or fixed settleAmount:undefined,// Replace with the amount to settle if needed theme:"dark",// Replace with your chosen theme }; ```