Skip to main content
API GUIDE

Call the Cutwise API with cURL, Python or JavaScript

The API uses the same solver-v1 request and result model as the browser calculator. Keep API keys on the server, set an explicit timeout and do not automatically retry an uncertain solve response.

Updated: · Toreniva Cutwise technical review

Start optimizing freeDownload the complete JSON request

cURL

curl --fail-with-body \
  --header "Authorization: Bearer $CUTWISE_API_KEY" \
  --header "Content-Type: application/json" \
  --data-binary @cutwise-api-example-request.json \
  https://cut.toreniva.com/api/v1/solve

Python

import os, requests

with open("cutwise-api-example-request.json", "rb") as body:
    response = requests.post(
        "https://cut.toreniva.com/api/v1/solve",
        headers={"Authorization": f"Bearer {os.environ['CUTWISE_API_KEY']}"},
        data=body, timeout=60,
    )
response.raise_for_status()
result = response.json()

JavaScript and retry safety

A server may have completed a solve even if the client loses the response. Treat timeouts and connection loss as an uncertain outcome; inspect account activity and retain X-Request-Id for support instead of blindly resubmitting.

const response = await fetch('https://cut.toreniva.com/api/v1/solve', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CUTWISE_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(problem),
  signal: AbortSignal.timeout(60_000),
});
if (!response.ok) throw new Error(`Cutwise HTTP ${response.status}`);
const result = await response.json();