REST API
You can use the Storelayer API directly with any HTTP client. No SDK required.
Base URL
Section titled “Base URL”https://api.storelayer.io/v1Authentication
Section titled “Authentication”Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEYExample: Python
Section titled “Example: Python”import requests
BASE_URL = "https://api.storelayer.io/v1"HEADERS = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json",}
# Create a customerresponse = requests.post( f"{BASE_URL}/customers", headers=HEADERS, json={"email": "jane@example.com", "name": "Jane Doe"},)customer = response.json()["data"]
# Credit pointsrequests.post( f"{BASE_URL}/wallets/{customer['id']}/credit", headers=HEADERS, json={"amount": 500, "reason": "Welcome bonus"},)Example: Go
Section titled “Example: Go”package main
import ( "bytes" "encoding/json" "net/http")
func main() { body, _ := json.Marshal(map[string]any{ "email": "jane@example.com", "name": "Jane Doe", })
req, _ := http.NewRequest("POST", "https://api.storelayer.io/v1/customers", bytes.NewBuffer(body)) req.Header.Set("Authorization", "Bearer YOUR_API_KEY") req.Header.Set("Content-Type", "application/json")
client := &http.Client{} resp, _ := client.Do(req) defer resp.Body.Close()}