Skip to Content

cURL Quickstart

Call the Carapis API straight from your terminal with cURL — pass the Bearer header, hit GET /v2/listings, and pipe the JSON anywhere. Ideal for testing, scripts and CI.

Set your key

Get a key at my.carapis.com  and export it:

export CARAPIS_API_KEY="your_api_key_here"

First request

curl "https://api.carapis.com/v2/listings?source=encar&limit=20" \ -H "Authorization: Bearer $CARAPIS_API_KEY"

Set source to any slug from the platforms page. Pipe through jq to read fields:

curl -s "https://api.carapis.com/v2/listings?source=encar&limit=20" \ -H "Authorization: Bearer $CARAPIS_API_KEY" \ | jq '.results[] | {make, model, year, price}'

Filtering

Use -G with --data-urlencode so values are escaped correctly:

curl -G "https://api.carapis.com/v2/listings" \ --data-urlencode "source=encar" \ --data-urlencode "make=Hyundai" \ --data-urlencode "model=Grandeur" \ --data-urlencode "year_min=2021" \ --data-urlencode "price_max=30000000" \ --data-urlencode "limit=20" \ -H "Authorization: Bearer $CARAPIS_API_KEY"

See every parameter in the listings reference.

Paging

Increment page until the results array comes back empty:

curl "https://api.carapis.com/v2/listings?source=encar&limit=50&page=2" \ -H "Authorization: Bearer $CARAPIS_API_KEY"

Inspecting status codes

Print the HTTP status to handle errors in scripts:

curl -s -o response.json -w "%{http_code}\n" \ "https://api.carapis.com/v2/listings?source=encar&limit=20" \ -H "Authorization: Bearer $CARAPIS_API_KEY"

See Authentication, Pagination, Rate limits and Errors for the full reference.