### Authenticate and Request Data from Satflow API Source: https://docs.satflow.com/reference/overview This example demonstrates how to authenticate with the Satflow API using a provided API key and make a GET request to retrieve data. It requires an API key to be included in the 'x-api-key' header. ```bash curl -X 'GET' \ 'https://api.satflow.com/v1' \ -H 'accept: application/json' \ -H 'x-api-key: YOUR_API_KEY' ``` -------------------------------- ### Authentication Example Source: https://docs.satflow.com/reference/index This example demonstrates how to authenticate your requests to the Satflow API using an API key. ```APIDOC ## GET /v1 ### Description This is a sample endpoint to demonstrate API authentication. It requires an `x-api-key` header for access. ### Method GET ### Endpoint `https://api.satflow.com/v1` ### Parameters #### Headers - **x-api-key** (string) - Required - Your unique API key. - **accept** (string) - Required - Should be set to `application/json`. ### Request Example ```bash curl -X 'GET' \ 'https://api.satflow.com/v1' \ -H 'accept: application/json' \ -H 'x-api-key: YOUR_API_KEY' ``` ### Response #### Success Response (200) - **message** (string) - A confirmation message indicating successful authentication. #### Response Example ```json { "message": "Authentication successful" } ``` ``` -------------------------------- ### Get Wallet Contents (Python) Source: https://docs.satflow.com/reference/get-wallet Example Python code using the 'requests' library to fetch wallet contents. It shows how to send a GET request with headers and handle the response. ```python # Placeholder for Python code example. Actual implementation would involve the 'requests' library. ``` -------------------------------- ### Get Wallet Contents (Shell/cURL) Source: https://docs.satflow.com/reference/get-wallet Example cURL request to retrieve wallet contents. This demonstrates the HTTP GET method, URL, and required headers. ```shell curl --request GET \ --url https://api.satflow.com/v1/address/wallet-contents \ --header 'accept: application/json' ``` -------------------------------- ### Get Item Details API Request (Python) Source: https://docs.satflow.com/reference/get-item-1 Demonstrates how to call the Satflow API to get item details using Python's 'requests' library. This example sends a GET request and prints the JSON response. ```python import requests url = "https://api.satflow.com/v1/item" headers = { "accept": "application/json" } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Get Wallet Contents (PHP) Source: https://docs.satflow.com/reference/get-wallet Example PHP code using cURL to get wallet contents. This demonstrates setting up the cURL request, executing it, and processing the JSON response. ```php // Placeholder for PHP code example. Actual implementation would involve cURL or file_get_contents with stream contexts. ``` -------------------------------- ### Get Wallet Contents (Node.js) Source: https://docs.satflow.com/reference/get-wallet Example Node.js code to fetch wallet contents using the 'got' library. It shows how to construct the request with parameters and handle the JSON response. ```javascript // Placeholder for Node.js code example. Actual implementation would involve an HTTP client library like 'got' or 'axios'. ``` -------------------------------- ### Get Item Details API Request (Ruby) Source: https://docs.satflow.com/reference/get-item-1 Illustrates how to retrieve item details from the Satflow API using Ruby's Net::HTTP library. This example performs a GET request and parses the JSON response. ```ruby require 'net/http' require 'uri' uri = URI.parse('https://api.satflow.com/v1/item') request = Net::HTTP::Get.new(uri) request['accept'] = 'application/json' response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end puts response.body ``` -------------------------------- ### Get Item Details API Request (Node.js) Source: https://docs.satflow.com/reference/get-item-1 Provides an example of how to fetch item details from the Satflow API using Node.js. This snippet utilizes the 'node-fetch' library to make the HTTP GET request and expects a JSON response. ```javascript const fetch = require('node-fetch'); const options = { method: 'GET', headers: { 'accept': 'application/json' } }; fetch('https://api.satflow.com/v1/item', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err)); ``` -------------------------------- ### Get Challenge Message for Wallet Verification (Node.js) Source: https://docs.satflow.com/reference/satflow-challenge-1 Provides an example of fetching a challenge message for wallet verification using Node.js. This typically involves using a library like 'axios' or the built-in 'fetch' to make a GET request to the Satflow API. ```javascript // Node.js example const axios = require('axios'); const getChallenge = async () => { try { const response = await axios.get('https://api.satflow.com/v1/challenge', { headers: { 'accept': 'application/json' } }); console.log(response.data); return response.data; } catch (error) { console.error('Error fetching challenge:', error); throw error; } }; getChallenge(); ``` -------------------------------- ### Get Active Bids for an Address (Node.js) Source: https://docs.satflow.com/reference/get-bidding-1 This Node.js snippet shows how to fetch active bids for an address using the `node-fetch` library. It constructs the GET request with appropriate headers and handles the JSON response. Ensure `node-fetch` is installed (`npm install node-fetch`). ```javascript import fetch from 'node-fetch'; const url = 'https://api.satflow.com/v1/address/bids'; const address = 'YOUR_WALLET_ADDRESS'; // Replace with the actual wallet address async function getActiveBids(address) { try { const response = await fetch(`${url}?address=${address}`, { method: 'GET', headers: { 'accept': 'application/json' } }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log(data); return data; } catch (error) { console.error('Error fetching active bids:', error); } } getActiveBids(address); ``` -------------------------------- ### Place a Bid (cURL) Source: https://docs.satflow.com/reference/place-bid Example of placing a bid using cURL. This demonstrates the POST request to the /v1/bid/place endpoint with appropriate headers. ```shell curl --request POST \ --url https://api.satflow.com/v1/bid/place \ --header 'accept: application/json' \ --header 'content-type: application/json' ``` -------------------------------- ### Get Active Bids for an Address (Python) Source: https://docs.satflow.com/reference/get-bidding-1 This Python snippet illustrates how to retrieve active bids for an address using the `requests` library. It sends a GET request to the Satflow API endpoint and processes the JSON response. Make sure to install the `requests` library (`pip install requests`). ```python import requests url = "https://api.satflow.com/v1/address/bids" address = "YOUR_WALLET_ADDRESS" # Replace with the actual wallet address params = { "address": address } headers = { "accept": "application/json" } try: response = requests.get(url, params=params, headers=headers) response.raise_for_status() # Raise an exception for bad status codes data = response.json() print(data) except requests.exceptions.RequestException as e: print(f"Error fetching active bids: {e}") ``` -------------------------------- ### Place a Bid (Ruby) Source: https://docs.satflow.com/reference/place-bid Example of placing a bid using Ruby. This demonstrates making a POST request to the Satflow API with JSON content. ```ruby # Ruby example for placing a bid # Requires 'net/http' and 'json' require 'net/http' require 'uri' require 'json' def place_bid(bid_details) uri = URI.parse('https://api.satflow.com/v1/bid/place') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri) request['accept'] = 'application/json' request['content-type'] = 'application/json' request.body = bid_details.to_json response = http.request(request) JSON.parse(response.body) end # Example usage: # inscription_bid = { inscriptionId: 'inscription_id', amount: 1000 } # puts place_bid(inscription_bid) # collection_bid = { collectionId: 'collection_id', amount: 5000 } # puts place_bid(collection_bid) ``` -------------------------------- ### POST /intent/sell Source: https://docs.satflow.com/reference/create-a-listing Generates the necessary PSBTs for creating a listing. This is the first step in the listing process. ```APIDOC ## POST /intent/sell ### Description Generates the necessary Partially Signed Bitcoin Transactions (PSBTs) required to create a listing on Satflow. This endpoint is the initial step in the programmatic listing process. ### Method POST ### Endpoint /intent/sell ### Parameters #### Request Body - **inscription_id** (string) - Optional - The ID of the inscription to be listed. Either `inscription_id` or `runes_output` is required. - **runes_output** (string) - Optional - The output identifier for a Rune to be listed. Either `inscription_id` or `runes_output` is required. - **ord_address** (string) - Required - The owner address of the item being listed. - **receive_address** (string) - Required - The address where the payment for the sale will be sent. - **price** (integer) - Required - The listing price in satoshis. - **tap_key** (string) - Required - The public key associated with the `ord_address`, typically 66 hexadecimal characters. - **collection_slug** (string) - Optional - The slug of the collection the item belongs to. ### Request Example ```json { "inscription_id": "inscription_id_example", "ord_address": "ord_address_example", "receive_address": "receive_address_example", "price": 10000, "tap_key": "tap_key_example" } ``` ### Response #### Success Response (200) - **unsignedListingPSBTBase64** (string) - The base64 encoded unsigned listing PSBT. - **secureListingPSBTs** (array) - An array containing secure listing PSBTs to be signed. #### Response Example ```json { "unsignedListingPSBTBase64": "unsigned_psbt_base64_example", "secureListingPSBTs": [ { "psbtBase64": "secure_psbt_base64_example", "sighash": "ALL | ANYONECANPAY", "indicesToSign": [0] } ] } ``` ``` -------------------------------- ### Get Challenge Message for Wallet Verification (Python) Source: https://docs.satflow.com/reference/satflow-challenge-1 Demonstrates how to get a challenge message for wallet verification using Python. This example utilizes the 'requests' library to perform a GET request to the Satflow API. ```python # Python example import requests url = "https://api.satflow.com/v1/challenge" headers = { 'accept': 'application/json' } try: response = requests.get(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes print(response.json()) except requests.exceptions.RequestException as e: print(f"Error: {e}") ``` -------------------------------- ### POST /v1/intent/sell Source: https://docs.satflow.com/reference/create-listing Creates an unsigned PSBT for a single listing that needs to be signed by the user. ```APIDOC ## POST /v1/intent/sell ### Description Creates an unsigned PSBT for a single listing that needs to be signed by the user. ### Method POST ### Endpoint https://api.satflow.com/v1/intent/sell ### Parameters #### Query Parameters None #### Request Body - **price** (number) - Required - Listing price in satoshis - **inscriptionId** (string) - Optional - Inscription ID to list - **runesOutput** (string) - Optional - Runes output to list - **sellerOrdAddress** (string) - Required - Seller's ordinal address - **sellerReceiveAddress** (string) - Required - Address to receive payment - **externalOrderId** (string) - Optional - External order ID - **tapInternalKey** (string) - Optional - Taproot internal key - **newLocation** (string) - Optional - New location - **runesData** (object) - Optional - Runes data ### Request Example ```json { "price": 10000, "inscriptionId": "inscription_id_example", "sellerOrdAddress": "seller_ord_address_example", "sellerReceiveAddress": "seller_receive_address_example" } ``` ### Response #### Success Response (200) - **message** (string) - Sell intent created successfully #### Error Response (400) - **message** (string) - Invalid parameters #### Response Example ```json { "message": "Sell intent created successfully" } ``` ``` -------------------------------- ### Fill/Accept Bid - Ruby Source: https://docs.satflow.com/reference/sell-listing This Ruby example shows how to submit a bid for filling or accepting using the Satflow API. It makes a POST request with the necessary headers to the specified endpoint. ```ruby require 'net/http' require 'uri' require 'json' def fill_bid(bid_details) uri = URI.parse('https://api.satflow.com/v1/bid/fill') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri) request['accept'] = 'application/json' request['content-type'] = 'application/json' request.body = bid_details.to_json response = http.request(request) if response.is_a?(Net::HTTPSuccess) return JSON.parse(response.body) else puts "Error filling bid: #{response.code} #{response.message}" return nil end end # Example usage: # bid_data = { ... inscription bid or collection bid details ... }.to_json # result = fill_bid(JSON.parse(bid_data)) # puts result ``` -------------------------------- ### Edit Listing Source: https://docs.satflow.com/reference/create-a-listing To edit an existing listing, repeat the process of generating, signing, and submitting PSBTs using the /intent/sell and /list endpoints. ```APIDOC ## Edit Listing ### Description To edit an existing listing on Satflow, you do not need to cancel it first. Simply repeat the process of generating, signing, and submitting PSBTs using the `/intent/sell` and `/list` endpoints with the updated listing details. ### Method POST ### Endpoint /intent/sell then /list ### Parameters Refer to the parameters documentation for `POST /intent/sell` and `POST /list`. Ensure you provide the updated `price` or other relevant details in the request body for the `/list` endpoint. ### Request Example Follow the examples provided for `POST /intent/sell` and `POST /list`, ensuring the `price` or other desired fields are updated. ### Response Refer to the response documentation for `POST /list`. ``` -------------------------------- ### Get Wallet Contents (Ruby) Source: https://docs.satflow.com/reference/get-wallet Example Ruby code to retrieve wallet contents using the 'net/http' library. This snippet illustrates making an HTTP GET request and parsing the JSON response. ```ruby # Placeholder for Ruby code example. Actual implementation would involve the 'net/http' or similar libraries. ``` -------------------------------- ### POST /list Source: https://docs.satflow.com/reference/create-a-listing Submits signed PSBTs to finalize the listing of an item on Satflow. ```APIDOC ## POST /list ### Description Submits the signed Partially Signed Bitcoin Transactions (PSBTs) to Satflow to finalize the listing of an item. This is the final step after generating and signing the PSBTs. ### Method POST ### Endpoint /list ### Parameters #### Request Body - **inscription_id** (string) - Optional - The ID of the inscription being listed. Required if not provided during PSBT generation. - **runes_output** (string) - Optional - The output identifier for a Rune being listed. Required if not provided during PSBT generation. - **ord_address** (string) - Required - The owner address of the item being listed. - **receive_address** (string) - Required - The address where the payment for the sale will be sent. - **price** (integer) - Required - The listing price in satoshis. - **tap_key** (string) - Required - The public key associated with the `ord_address`. - **signed_listing_psbt** (string) - Required - The signed insecure listing PSBT in base64 or hex format. - **signed_secure_listing_psbt** (string) - Required - The signed secure listing PSBT in base64 or hex format. - **unsigned_listing_psbt** (string) - Optional - The original unsigned listing PSBT in base64 or hex format. - **collection_slug** (string) - Optional - The slug of the collection the item belongs to. ### Request Example ```json { "inscription_id": "inscription_id_example", "ord_address": "ord_address_example", "receive_address": "receive_address_example", "price": 10000, "tap_key": "tap_key_example", "signed_listing_psbt": "signed_psbt_base64_example", "signed_secure_listing_psbt": "signed_secure_psbt_base64_example" } ``` ### Response #### Success Response (200) - **listing_id** (string) - The unique identifier for the created listing. - **status** (string) - The status of the listing (e.g., "active"). #### Response Example ```json { "listing_id": "listing_id_example", "status": "active" } ``` ``` -------------------------------- ### Place a Bid (Python) Source: https://docs.satflow.com/reference/place-bid Example of placing a bid using Python with the 'requests' library. This shows how to perform a JSON POST request to the Satflow API. ```python import requests import json def place_bid(bid_details): url = 'https://api.satflow.com/v1/bid/place' headers = { 'accept': 'application/json', 'content-type': 'application/json' } try: response = requests.post(url, headers=headers, json=bid_details) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: print(f'Error placing bid: {e}') return None # Example usage: # inscription_bid = {'inscriptionId': 'inscription_id', 'amount': 1000} # result = place_bid(inscription_bid) # if result: # print(result) # # collection_bid = {'collectionId': 'collection_id', 'amount': 5000} # result = place_bid(collection_bid) # if result: # print(result) ``` -------------------------------- ### Get Bid Activity Data (cURL) Source: https://docs.satflow.com/reference/get-activity-1 This snippet demonstrates how to retrieve bid activity data using a cURL request. It specifies the GET endpoint and includes the 'accept' header for JSON responses. No specific filtering parameters are shown in this basic example. ```shell curl --request GET \ --url https://api.satflow.com/v1/activity/bids \ --header 'accept: application/json' ``` -------------------------------- ### Place a Bid (Node.js) Source: https://docs.satflow.com/reference/place-bid Example of placing a bid using Node.js. This snippet shows how to make a POST request to the Satflow API for bidding. ```javascript // Node.js example for placing a bid // Requires 'axios' or similar HTTP client const axios = require('axios'); async function placeBid(bidDetails) { try { const response = await axios.post('https://api.satflow.com/v1/bid/place', bidDetails, { headers: { 'accept': 'application/json', 'content-type': 'application/json' } }); return response.data; } catch (error) { console.error('Error placing bid:', error.response ? error.response.data : error.message); throw error; } } // Example usage: // const inscriptionBid = { inscriptionId: 'inscription_id', amount: 1000 }; // placeBid(inscriptionBid).then(data => console.log(data)).catch(err => {}); // const collectionBid = { collectionId: 'collection_id', amount: 5000 }; // placeBid(collectionBid).then(data => console.log(data)).catch(err => {}); ``` -------------------------------- ### Get Challenge Message for Wallet Verification (PHP) Source: https://docs.satflow.com/reference/satflow-challenge-1 Shows a PHP implementation for retrieving a challenge message for wallet verification. This example uses cURL functions to send a GET request to the specified API. ```php // PHP example ``` -------------------------------- ### Create Sell Intent (Python) Source: https://docs.satflow.com/reference/create-listing Python example for creating a sell intent. This code demonstrates how to make a POST request to the Satflow API using Python's 'requests' library, including request body parameters. ```python import requests def create_sell_intent(params): url = 'https://api.satflow.com/v1/intent/sell' headers = {'content-type': 'application/json'} try: response = requests.post(url, headers=headers, json=params) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: print(f"Error creating sell intent: {e}") raise # Example usage: # params = { # 'price': 1000000, # 'inscriptionId': 'inscription_id_here', # 'sellerOrdAddress': 'seller_ordinal_address_here', # 'sellerReceiveAddress': 'seller_receive_address_here', # 'externalOrderId': 'optional_external_id' # } # try: # result = create_sell_intent(params) # print(result) # except Exception as e: # print(f"Failed to get result: {e}") ``` -------------------------------- ### Create Sell Intent (cURL) Source: https://docs.satflow.com/reference/create-listing Example cURL request for creating a sell intent. This demonstrates how to make a POST request to the Satflow API endpoint, including necessary headers and URL. ```shell curl --request POST \ --url https://api.satflow.com/v1/intent/sell \ --header 'content-type: application/json' ``` -------------------------------- ### Satflow Marketplace API - General Information Source: https://docs.satflow.com/reference/overview This section provides general information about the Satflow Marketplace API, including authentication details and available endpoints. ```APIDOC ## Satflow Marketplace API ### Description The Satflow Marketplace API allows users to programmatically manage item listings, retrieve listing data, bid data, and sales data. ### Authentication API requests require an `x-api-key` header with a valid API key. #### Obtaining an API Key Obtain an API key by opening a ticket on the Satflow Discord server: [https://discord.gg/satflow](https://discord.gg/satflow). ### Example Request (Authentication) ```bash curl -X 'GET' \ 'https://api.satflow.com/v1' \ -H 'accept: application/json' \ -H 'x-api-key: YOUR_API_KEY' ``` ### Endpoints **BTC Mainnet:** - **URL:** `https://api.satflow.com/v1` - **Documentation:** `https://docs.satflow.com` ### Rate Limits Rate limits vary based on the API tier. Partner tier limits depend on specific requirements. ``` -------------------------------- ### Get floor listings for collections (cURL) Source: https://docs.satflow.com/reference/listings-1 This snippet demonstrates how to retrieve floor listings for collections using cURL. It requires the collection IDs as a query parameter and specifies the 'accept' header for JSON responses. This is a basic example for making the API call. ```shell curl --request GET \ --url https://api.satflow.com/v1/orders/floor \ --header 'accept: application/json' ``` -------------------------------- ### Fill/Accept Bid - Python Source: https://docs.satflow.com/reference/sell-listing This Python snippet illustrates how to interact with the Satflow API to fill or accept a bid. It uses the 'requests' library to perform a POST request, including setting the correct headers. ```python import requests import json def fill_bid(bid_details): url = "https://api.satflow.com/v1/bid/fill" headers = { "accept": "application/json", "content-type": "application/json" } try: response = requests.post(url, headers=headers, data=json.dumps(bid_details)) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: print(f"Error filling bid: {e}") return None # Example usage: # bid_data = { ... inscription bid or collection bid details ... } # result = fill_bid(bid_data) # if result: # print(result) ``` -------------------------------- ### Create Listing with PSBTs - OpenAPI Definition Source: https://docs.satflow.com/reference/post_list This OpenAPI definition describes the '/list' endpoint for creating listings on the Satflow Marketplace. It requires signed PSBTs and listing details, including price, seller addresses, and optional inscription or runes information. The request body is a JSON object containing an array of listing objects and signed PSBT strings. ```json { "openapi": "3.0.3", "info": { "version": "1.1.0-prod", "title": "Satflow Marketplace API", "description": "## Satflow Marketplace API\n\nThe Satflow Marketplace API is a RESTful API that allows you to interact with the Satflow Marketplace. The API allows you to:\n\n- **Item and collection Details**: Get information about items and collections on Satflow.\n- **Listing Items for Sale**: Create and manage listings for selling items on Satflow.\n- **Bidding Items for Purchase**: Create and manage bids for buying items on Satflow.\n- **Listing Data**: Retrieve current listing information.\n- **Bid Data**: Retrieve current bid information.\n- **Sales Data**: Retrieve historical sales information.\n\n**A great open source example on how to use the Satflow endpoints can be found in [Satflow Market Maker](https://github.com/SwapLabsInc/satflow-mm)**\n\n### Authentication:\nThis API requires API keys for authentication. You can obtain an API key by contacting support on [Discord](https://discord.gg/satflow).\n", "contact": { "name": "Satflow Discord", "url": "https://discord.gg/satflow" } }, "servers": [ { "url": "https://api.satflow.com/v1", "description": "Production server" } ], "components": { "securitySchemes": { "ApiKeyAuth": { "type": "apiKey", "in": "header", "name": "x-api-key" } } }, "security": [ { "ApiKeyAuth": [] } ], "paths": { "/list": { "post": { "tags": [ "Create listing" ], "summary": "Create listings from signed PSBTs", "description": "Submit signed listing PSBTs to create active listings on the marketplace", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "listings", "signedListingPSBT", "signedSecureListingPSBTs" ], "properties": { "listings": { "type": "array", "description": "Array of listing objects", "items": { "type": "object", "required": [ "price", "sellerOrdAddress", "sellerReceiveAddress" ], "properties": { "price": { "type": "number", "description": "Listing price in satoshis", "example": 100000 }, "inscriptionId": { "type": "string", "description": "Inscription ID to list", "example": "abc123def456..." }, "runesOutput": { "type": "string", "description": "Runes output to list", "example": "txid:vout" }, "sellerOrdAddress": { "type": "string", "description": "Seller's ordinal address", "example": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh" }, "sellerReceiveAddress": { "type": "string", "description": "Address to receive payment", "example": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh" }, "externalOrderId": { "type": "string", "description": "External order ID (optional)" }, "tapInternalKey": { "type": "string", "description": "Taproot internal key (optional)" }, "newLocation": { "type": "string", "description": "New location (optional)" }, "runesData": { "type": "object", "description": "Runes data (optional)" } } } }, "signedListingPSBT": { "type": "string", "description": "Signed listing PSBT in base64 format", "example": "cHNidP8BAH0CAAAAAe..." }, "unsignedListingPSBT": { "type": "string", "description": "Unsigned listing PSBT in base64 format (optional)" } } } } } } } } } } ``` -------------------------------- ### Get Item Details API Request (PHP) Source: https://docs.satflow.com/reference/get-item-1 Shows a PHP implementation for fetching item details from the Satflow API using cURL. This snippet configures cURL to send a GET request with the appropriate 'accept' header. ```php ``` -------------------------------- ### Get Item Details API Request (cURL) Source: https://docs.satflow.com/reference/get-item-1 Demonstrates how to make a GET request to the Satflow API to retrieve details for a specific item using cURL. It specifies the endpoint URL and the expected JSON response format. ```shell curl --request GET \ --url https://api.satflow.com/v1/item \ --header 'accept: application/json' ``` -------------------------------- ### Create Sell Intent (Ruby) Source: https://docs.satflow.com/reference/create-listing Ruby example for creating a sell intent. This snippet illustrates how to send a POST request to the Satflow API using Ruby's 'net/http' library, including request body parameters. ```ruby require 'net/http' require 'uri' require 'json' def create_sell_intent(params) uri = URI.parse('https://api.satflow.com/v1/intent/sell') http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri) request['content-type'] = 'application/json' request.body = params.to_json begin response = http.request(request) return JSON.parse(response.body) rescue => e puts "Error creating sell intent: #{e.message}" raise end end # Example usage: # params = { # price: 1000000, # inscriptionId: 'inscription_id_here', # sellerOrdAddress: 'seller_ordinal_address_here', # sellerReceiveAddress: 'seller_receive_address_here', # externalOrderId: 'optional_external_id' # } # begin # result = create_sell_intent(params) # puts result # rescue => e # puts "Failed to get result: #{e}" # end ``` -------------------------------- ### POST /websites/satflow_reference/listings Source: https://docs.satflow.com/reference/post_list Creates new listings for sale. This endpoint allows users to submit a list of items they wish to sell, along with associated transaction details and broadcasting preferences. ```APIDOC ## POST /websites/satflow_reference/listings ### Description Creates new listings for sale. This endpoint allows users to submit a list of items they wish to sell, along with associated transaction details and broadcasting preferences. ### Method POST ### Endpoint /websites/satflow_reference/listings ### Parameters #### Request Body - **signedSecureListingPSBTs** (array) - Required - Array of signed secure listing PSBTs - **items** (string) - Signed secure listing PSBT in base64 format - **skipBroadcast** (boolean) - Optional - Whether to skip broadcasting the transaction (default: false) ### Request Example ```json { "signedSecureListingPSBTs": [ "cHNidP8BAH0CAAAAAe..." ], "skipBroadcast": false } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful - **data** (object) - Contains details of the created listings - **txid** (string) - Transaction ID of the broadcast listing - **listings** (array) - Created listing objects - **_id** (string) - Listing ID - **price** (number) - Listing price - **inscriptionId** (string) - Inscription ID - **status** (string) - Listing status #### Response Example ```json { "success": true, "data": { "txid": "a1b2c3d4e5f67890a1b2c3d4e5f67890", "listings": [ { "_id": "listing123", "price": 1000, "inscriptionId": "inscription456", "status": "active" } ] } } ``` #### Error Response (400) - **error** (string) - Description of the error #### Error Response (500) - **error** (string) - Description of the error ``` -------------------------------- ### Get Active Bids for an Address (cURL) Source: https://docs.satflow.com/reference/get-bidding-1 This snippet demonstrates how to make a GET request to the Satflow API to retrieve active bids for a specified address using cURL. It includes the necessary URL and headers for the request. The response will be in JSON format. ```shell curl --request GET \ --url https://api.satflow.com/v1/address/bids \ --header 'accept: application/json' ``` -------------------------------- ### Place a Bid (PHP) Source: https://docs.satflow.com/reference/place-bid Example of placing a bid using PHP. This snippet shows how to send a POST request with JSON data to the Satflow API. ```php = 200 && $http_code < 300) { return json_decode($response, true); } else { error_log('API error - HTTP Code: ' . $http_code . ' Response: ' . $response); return false; } } // Example usage: // $inscription_bid = ['inscriptionId' => 'inscription_id', 'amount' => 1000]; // print_r(place_bid($inscription_bid)); // $collection_bid = ['collectionId' => 'collection_id', 'amount' => 5000]; // print_r(place_bid($collection_bid)); ?> ``` -------------------------------- ### Get Collection Statistics with Python Source: https://docs.satflow.com/reference/get-collection-1 This Python snippet illustrates how to obtain collection statistics from the Satflow API using the 'requests' library. It performs a GET request to the API endpoint, including the 'accept' header and the mandatory 'collectionId' query parameter. ```python import requests url = "https://api.satflow.com/v1/collection-stats" params = { "collectionId": "YOUR_COLLECTION_ID" } headers = { "accept": "application/json" } response = requests.get(url, params=params, headers=headers) print(response.json()) ```