Skip to main content

Resource (Document) API

The Resource API exposes every doctype on your Smarty.tel site as a REST resource at:

/api/resource/<doctype>
/api/resource/<doctype>/<name>

<doctype> is the record type (e.g. Customer, Ticket, Contact, Lead, Sales Invoice). <name> is the primary key (the document's name field) of a specific record.

List documents

GET /api/resource/<doctype>

Returns a paginated list of documents. By default only the name field is returned per document — use fields to request more.

Query parameters

ParameterTypeDescription
fieldsJSON array (string)Fields to return, e.g. ["name","subject","status"]. Use ["*"] for all fields.
filtersJSON array (string)List of [fieldname, operator, value] triples, ANDed together.
or_filtersJSON array (string)Same shape as filters, but ORed together.
order_bystringe.g. creation desc
limit_startintegerOffset for pagination. Default 0.
limit_page_lengthintegerPage size. Default 20. Use 0 for no limit (admin only).

Supported filter operators: =, !=, >, <, >=, <=, like, not like, in, not in, between, is.

Example

curl -G "https://app.smarty.tel/api/resource/Ticket" \
-H "Authorization: token <api_key>:<api_secret>" \
--data-urlencode 'fields=["name","subject","status","owner"]' \
--data-urlencode 'filters=[["status","=","Open"],["priority","=","High"]]' \
--data-urlencode 'order_by=modified desc' \
--data-urlencode 'limit_page_length=10'
{
"data": [
{
"name": "TICK-2026-00042",
"subject": "Cannot activate SIM card",
"status": "Open",
"owner": "agent@smarty.tel"
}
]
}

Get a single document

GET /api/resource/<doctype>/<name>

Returns the full document, including child tables.

curl -X GET "https://app.smarty.tel/api/resource/Ticket/TICK-2026-00042" \
-H "Authorization: token <api_key>:<api_secret>"
{
"data": {
"name": "TICK-2026-00042",
"subject": "Cannot activate SIM card",
"status": "Open",
"priority": "High",
"creation": "2026-08-18 09:12:03",
"modified": "2026-08-19 07:40:11"
}
}

Create a document

POST /api/resource/<doctype>

Send the new document's fields as a JSON body. Required fields depend on the doctype's schema.

curl -X POST "https://app.smarty.tel/api/resource/Ticket" \
-H "Authorization: token <api_key>:<api_secret>" \
-H "Content-Type: application/json" \
-d '{
"subject": "SIM not activating",
"raised_by": "customer@example.com",
"priority": "High"
}'

Returns 200 OK with the created document, including its generated name.

Update a document

PUT /api/resource/<doctype>/<name>

Send only the fields you want to change; unspecified fields are left as-is.

curl -X PUT "https://app.smarty.tel/api/resource/Ticket/TICK-2026-00042" \
-H "Authorization: token <api_key>:<api_secret>" \
-H "Content-Type: application/json" \
-d '{"status": "Resolved"}'

Delete a document

DELETE /api/resource/<doctype>/<name>
curl -X DELETE "https://app.smarty.tel/api/resource/Ticket/TICK-2026-00042" \
-H "Authorization: token <api_key>:<api_secret>"

Returns 202 Accepted on success. Deletion respects permissions and any linked-document restrictions configured on the doctype.

Child tables

Documents with child tables (e.g. line items on an invoice) return the child rows as a nested array under the child table's fieldname. To update a child table, send the full replacement array for that fieldname in a PUT request — child tables are replaced wholesale, not merged row-by-row.

Pagination pattern

To page through a large result set, increment limit_start by limit_page_length until a response returns fewer rows than requested:

curl -G "https://app.smarty.tel/api/resource/Customer" \
-H "Authorization: token <api_key>:<api_secret>" \
--data-urlencode 'limit_start=20' \
--data-urlencode 'limit_page_length=20'

Next: Method API.