Skip to main content

Newclear API Overview

The Newclear REST API provides programmatic access to your Newclear data, enabling you to build custom integrations, automate workflows, and connect external systems.


Base URL

All API endpoints are relative to:

https://prod.newclear.io/api

All requests and responses use JSON format.


Authentication

The Newclear API uses Bearer token authentication. Include your API key in the Authorization header of every request:

Authorization: Bearer YOUR_API_KEY

Getting an API Key

  1. Log into Newclear
  2. Go to Settings → API Keys
  3. Click + Generate New Key
  4. Copy the key immediately (shown only once)

See API Keys for full key management documentation.

Example Request with Authentication

curl -X GET "https://prod.newclear.io/api/products" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"

Request Format

Headers

HeaderValueRequired
AuthorizationBearer YOUR_API_KEY
Content-Typeapplication/json✅ for POST/PUT
Acceptapplication/jsonRecommended

Request Body

For POST and PUT requests, send JSON in the request body:

{
"name": "Product Name",
"price": 29.99,
"sku": "ABC-001"
}

Response Format

All API responses follow a consistent envelope structure:

Success Response

{
"success": true,
"data": { ... },
"meta": {
"page": 1,
"per_page": 25,
"total": 150
}
}

Error Response

{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "The SKU field is required.",
"details": {
"sku": ["The SKU field is required."]
}
}
}

HTTP Status Codes

CodeMeaning
200 OKRequest succeeded
201 CreatedResource created successfully
204 No ContentRequest succeeded, no body returned (DELETE)
400 Bad RequestInvalid request parameters
401 UnauthorizedMissing or invalid API key
403 ForbiddenValid key but insufficient permissions
404 Not FoundResource doesn't exist
422 Unprocessable EntityValidation error
429 Too Many RequestsRate limit exceeded
500 Internal Server ErrorServer error (contact support)

Rate Limits

The API enforces rate limits to ensure stability:

PlanRate Limit
Standard120 requests/minute
Professional300 requests/minute
EnterpriseCustom limits

Rate limit headers are included in every response:

X-RateLimit-Limit: 120
X-RateLimit-Remaining: 87
X-RateLimit-Reset: 1699999999

If you exceed the limit, you receive a 429 response. Wait until X-RateLimit-Reset (Unix timestamp) before retrying.


Pagination

List endpoints return paginated results. Control pagination with query parameters:

GET /api/products?page=2&per_page=50
ParameterDefaultMax
page1
per_page25100

Pagination metadata is in the meta object of every list response:

{
"meta": {
"page": 2,
"per_page": 50,
"total": 312,
"total_pages": 7,
"has_next": true,
"has_prev": true
}
}

Filtering and Sorting

Most list endpoints support filtering via query parameters:

GET /api/products?status=active&category=furniture&sort=name&direction=asc

Common parameters:

ParameterDescription
searchFull-text search
statusFilter by status
sortSort field
directionasc or desc
fromDate filter start
toDate filter end

Versioning

The current API version is v1. The version is implicit in the base URL. If a breaking change is introduced, a new version (v2) will be released with migration documentation.


API Reference


SDKs and Examples

Currently, Newclear provides examples in:

  • cURL (shown in this documentation)
  • JavaScript/Node.js
  • PHP
  • Python

Code examples are included in each endpoint's documentation.