API Endpoints

Copy any curl request below and paste directly into Postman or your terminal. Or try it out in our interactive demo.

Core APIs

GEThttps://leafapi.com/api/project1/module1?limit=25&page=1&sort_field=created_at&sort_order=desc&search=

Retrieve paginated data with sort/search. Defaults: page=1, limit=25. Response includes meta links for next/prev/first/last pages.

CURL REQUEST:

curl -X GET "https://leafapi.com/api/project1/module1?limit=25&page=1&sort_field=created_at&sort_order=desc&search=" \ -H "leaf-api-key: LEAF_API_KEY_HERE"
POSThttps://leafapi.com/api/project1/module1

Create a new record in a module

CURL REQUEST:

curl -X POST "https://leafapi.com/api/project1/module1" \ -H "leaf-api-key: LEAF_API_KEY_HERE" \ -H "Content-Type: application/json" \ -d '{"name":"New Record","data":"value"}'
GEThttps://leafapi.com/api/project1/module1/:id

Retrieve details of a specific record

CURL REQUEST:

curl -X GET "https://leafapi.com/api/project1/module1/123" \ -H "leaf-api-key: LEAF_API_KEY_HERE"
PATCHhttps://leafapi.com/api/project1/module1/:id

Partially update a specific record

CURL REQUEST:

curl -X PATCH "https://leafapi.com/api/project1/module1/123" \ -H "leaf-api-key: LEAF_API_KEY_HERE" \ -H "Content-Type: application/json" \ -d '{"status":"active"}'
PUThttps://leafapi.com/api/project1/module1/:id

Completely replace a record

CURL REQUEST:

curl -X PUT "https://leafapi.com/api/project1/module1/123" \ -H "leaf-api-key: LEAF_API_KEY_HERE" \ -H "Content-Type: application/json" \ -d '{"name":"Updated Name","data":"new value"}'
DELETEhttps://leafapi.com/api/project1/module1/:id

Delete a specific record from a module

CURL REQUEST:

curl -X DELETE "https://leafapi.com/api/project1/module1/123" \ -H "leaf-api-key: LEAF_API_KEY_HERE"

Additional Operations

Use the following API to delete an entire module and all its records at once.

DELETEhttps://leafapi.com/api/project1/module2

Delete entire module and all its records - use with caution

CURL REQUEST:

curl -X DELETE "https://leafapi.com/api/project1/module2" \ -H "leaf-api-key: LEAF_API_KEY_HERE"
DELETEhttps://leafapi.com/api/project1

Delete entire project and all its modules/records - use with caution

CURL REQUEST:

curl -X DELETE "https://leafapi.com/api/project1" \ -H "leaf-api-key: LEAF_API_KEY_HERE"