Fields
When making a request to the API, you can specify the fields you want to retrieve for each record using the fields
parameter. If the parameter isn't included, the response will return a minimal set of default fields for the record(s) being requested. For most endpoints, the id
and etag
fields are the only default fields returned.
Fields must be provided as a comma-separated list. For example, to request the id
, etag
, and type
fields from the Activites endpoint, the URL would be as follows:
https://app.clio.com/api/v4/activities?fields=id,etag,type
If any requested fields are invalid, the API will return a 400 Bad Request
response.
For a complete list of each endpoint's available fields, refer to the "Response" section for each endpoint in the API Reference.
Nested Resources
Fields can also be specified for nested resources. This can be done by appending curly brackets with a comma separated list of fields to the nested resource. If a nested resource's fields are not specified, its default fields will be returned.
For example, to request Activities and include information about each activity's associated matter, the URL would be as follows:
https://app.clio.com/api/v4/activities?fields=id,etag,type,matter{id,description}
Second level nested resources will only return the default attributes. Attempting to request fields for a second-level nested resource will result a 400 Bad Request
.
For example, you can request the client
field for a nested matter on an activity like so:
https://app.clio.com/api/v4/activities?fields=id,etag,type,matter{id,description,client}
However, requesting the client's date_of_birth
field will result in a 400 Bad Request
response:
https://app.clio.com/api/v4/activities?fields=id,etag,type,matter{id,description,client{date_of_birth}}
To retrieve this information, you would need to make a separate request to either the Matters endpoint (requesting the fields client{date_of_birth}
) or the Contacts endpoint for that client's ID (requesting the field date_of_birth
)
Using the fields
parameter in POST/PATCH requests
The fields
parameter can also be included in POST
and PATCH
requests. If provided, the payload response will include the selected fields. This can be a helpful strategy to save the number of requests your application makes – you don't need to retrieve a record in a separate request after creating or updating it.
As an example: the total
field of Activity records is calculated based on the quantity
and price
fields provided when the record is created. When creating the record, you can request the total
field be returned in the response as follows:
curl -X POST \
"https://app.clio.com/api/v4/activities?fields=id,etag,total" \
-H "Authorization: Bearer WjR8H...dUUul" \
-H "Content-Type: application/json" \
-d '{"data": { "date": "2022-09-26", "quantity": 7200, "price": 200, "type": "TimeEntry" } }'
The response payload will then look like the following:
{
"data": {
"id": 347697,
"etag": "\"54e3163b889916a68f6d0d2c36334927\"",
"total": 400.0
}
}
As with GET
requests, if the fields
parameter isn't included, the response will return the default fields for the record.
The fields
parameter cannot be used when making DELETE
requests. Deleting a record will always return a 204 No Content
response with no body.