JSON:API spec requires every response to contain a top-level data
object/array which will contain one or many resource objects. Each resource object will contain the following properties:
type
- The type of the resource (e.g.products
,orders
, etc.)id
- The id of the resourceattributes
- An object representing the resources data
A resource object may also contain optional properties such as relationships
, links
and meta
.
Example
Request
Response
Errors
The Lemon Squeezy API uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx
range indicate success. Codes in the 4xx
range indicate an error that failed given the information provided (e.g., a required parameter was omitted, an action failed, etc). Codes in the 5xx
range indicate an error with our servers (these are rare).
A 4xx
error will always contain valid JSON:API errors array in the response. Each error object will usually contain several fields that explain the error, including detail
, status
, title
etc. For example: