Skip to main content
POST
/
credits
/
quick-topup
Quick top-up credits
curl --request POST \
  --url https://xquik.com/api/v1/credits/quick-topup \
  --header 'Content-Type: <content-type>' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "dollars": 123
}'
import requests

url = "https://xquik.com/api/v1/credits/quick-topup"

payload = { "dollars": 123 }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "<content-type>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': '<content-type>'},
body: JSON.stringify({dollars: 123})
};

fetch('https://xquik.com/api/v1/credits/quick-topup', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://xquik.com/api/v1/credits/quick-topup"

payload := strings.NewReader("{\n \"dollars\": 123\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "<content-type>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
Free - does not consume credits
response=$(curl -sS -X POST https://xquik.com/api/v1/credits/quick-topup \
  -H "x-api-key: xq_YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"dollars": 25}')
outcome=$(jq -r '.outcome' <<<"$response")

if [ "$outcome" = "requires_action" ]; then
  client_secret=$(jq -r '.clientSecret' <<<"$response")
  # Pass $client_secret to the billing confirmation flow; do not print it.
elif [ "$outcome" = "charged" ]; then
  jq '{outcome, credits, balance}' <<<"$response"
else
  jq '{outcome}' <<<"$response"
fi
const response = await fetch("https://xquik.com/api/v1/credits/quick-topup", {
  method: "POST",
  headers: {
    "x-api-key": "xq_YOUR_KEY_HERE",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ dollars: 25 }),
});
const result = await response.json();

if (result.outcome === "requires_action") {
  const paymentClientSecret = result.clientSecret;
  // Pass paymentClientSecret to the billing confirmation flow; do not print it.
} else if (result.outcome === "charged") {
  process.stdout.write(`Added ${result.credits} credits. Balance: ${result.balance}\n`);
} else {
  process.stdout.write("Add a payment method before quick top-up.\n");
}
import requests

response = requests.post(
    "https://xquik.com/api/v1/credits/quick-topup",
    headers={"x-api-key": "xq_YOUR_KEY_HERE"},
    json={"dollars": 25},
)
data = response.json()
if data["outcome"] == "requires_action":
    payment_client_secret = data["clientSecret"]
    # Pass payment_client_secret to the billing confirmation flow; do not print it.
elif data["outcome"] == "charged":
    print(f"Added {data['credits']} credits. Balance: {data['balance']}")
else:
    print("Add a payment method before quick top-up.")
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

func main() {
    body, _ := json.Marshal(map[string]interface{}{
        "dollars": 25,
    })

    req, err := http.NewRequest("POST", "https://xquik.com/api/v1/credits/quick-topup", bytes.NewReader(body))
    if err != nil {
        panic(err)
    }
    req.Header.Set("x-api-key", "xq_YOUR_KEY_HERE")
    req.Header.Set("Content-Type", "application/json")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    var data map[string]interface{}
    if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
        panic(err)
    }
    outcome, _ := data["outcome"].(string)
    if outcome == "requires_action" {
        clientSecret, _ := data["clientSecret"].(string)
        // Pass clientSecret to the billing confirmation flow; do not print it.
        _ = clientSecret
    } else if outcome == "charged" {
        credits, _ := data["credits"].(string)
        balance, _ := data["balance"].(string)
        fmt.Printf("Added %s credits. Balance: %s\n", credits, balance)
    } else {
        fmt.Println("Add a payment method before quick top-up.")
    }
}

Headers

x-api-key
string
required
Your API key. Session cookie authentication is also supported.
Content-Type
string
required
Must be application/json.

Body

dollars
number
required
Amount in US dollars to charge. Minimum 10,maximum10, maximum 500.
At USD 0.00015 per credit, a USD 25 quick top-up adds 166,666 credits, rounded down to whole credits. Only the charged outcome grants credits and updates balance. If the endpoint returns requires_action, complete payment authentication with clientSecret before retrying the metered API call. Pass clientSecret to the billing confirmation flow only; do not print it in logs. If it returns no_payment_method, create a checkout top-up instead.

Response

Payment succeeded immediately. Credits added to your balance.
outcome
string
Always "charged".
balance
string
Updated credit balance after top-up (Bigint string).
credits
string
Number of credits added (Bigint string).
{
  "outcome": "charged",
  "balance": "466666",
  "credits": "166666"
}
Last modified on May 14, 2026