← Sales API
Credits
Singular: Credit — Base URL: https://sale-api.ayoune.app — Access: CRUD
Try it now
beta
Response (live)
Requests are proxied through the consumer-app to *.ayoune.app. Tokens stay in your browser and are forwarded per call.
Example response (recorded) sample
A real, previously recorded GET /:id response of this endpoint — not the live call above. Sensitive fields are masked.
{
"payload": {
"consumption": {
"field": "",
"amount": 0
},
"_id": "65e0b1ea121b7d48fe15a436",
"team": [],
"product": "",
"invoice": "",
"value": 0,
"valueUnit": "days",
"remainingValue": 0,
"foreignCountry": false,
"createdBy": "6045f4d25704710012485569",
"createdAt": "2024-02-29T16:33:46.858Z",
"updatedAt": "2024-02-29T16:33:46.858Z"
},
"meta": {
"links": [
{
"rel": "self",
"href": "https://sale-api.ayoune.app/credits/65e0b1ea121b7d48fe15a436",
"method": "get",
"title": "GET",
"types": [
"application/json",
"application/yaml",
"text/csv"
]
}
],
"relations": [
{
"rel": "Consumers",
"title": "MODEL_CONSUMER",
"href": "https://api.ayoune.app/crm/consumers",
"method": "get",
"types": [
"application/json",
"application/yaml",
"text/csv"
],
"right": "crm.consumers"
}
],
"debugId": "6a61990d01c854403a7cc9ad",
"errors": [],
"actions": [
{
"rel": "self",
"action": "COPY",
"title": "MODEL_CREDIT",
"href": "https://api.ayoune.app/sale/credits/65e0b1ea121b7d48fe15a436/copy",
"method": "post",
"types": [
"application/json",
"application/yaml",
"text/csv"
]
},
{
"rel": "self",
"action": "DELETE",
"title": "MODEL_CREDIT",
"href": "https://api.ayoune.app/sale/credits/65e0b1ea121b7d48fe15a436/copy",
"method": "post",
"types": [
"application/json",
"application/yaml",
"text/csv"
]
}
],
"version": {
"host": "2026.37.2",
"core": "2026.257.1"
},
"rateLimit": {
"limit": "2500",
"remaining": "2401",
"reset": "1784784645",
"resetDate": "Thu Jul 23 2026"
},
"responseTime": 102.806037,
"code": 200,
"status": "success",
"error": false
}
}
Endpoints
| Method | Path | Description | Right |
|---|---|---|---|
| GET | /credits |
List with filters/pagination | sale.credits.view |
| GET | /credits/:id |
Single record | sale.credits.view |
| POST | /credits |
Create new record | sale.credits.new |
| PUT | /credits |
Update record | sale.credits.edit |
| DELETE | /credits/:id |
Delete record | sale.credits.delete |
SDK
import { aYOUne } from '@tolinax/ayoune';
const ay = new aYOUne('pat_your_token');
// List all
const list = await ay.sale.credits.find().limit(10).exec();
// Single record
const one = await ay.sale.credits.findById('OBJECT_ID').exec();
// Create
const created = await ay.sale.credits.create({ name: 'Foo' });