Retrieve Client Files

Retrieve a list of files associated with a specific client, optionally filtered by folder and paginated.

This endpoint retrieves a list of files associated with a specific client. You can filter the files by their parent folder or fetch files not in any folder. Pagination is supported through the count and offset parameters.

Example Requests:

Retrieve all files for a client:

curl "https://<your-agency>.smartmatchapp.com/api3/clients/<client_id>/files/" \
    -u <token>: \
    -X GET

Retrieve files within a specific folder:

curl "https://<your-agency>.smartmatchapp.com/api3/clients/<client_id>/files/?folder=1" \
    -u <token>: \
    -X GET

Retrieve files not in any folder:

curl "https://<your-agency>.smartmatchapp.com/api3/clients/<client_id>/files/?folder=0" \
    -u <token>: \
    -X GET

Retrieve files with pagination (e.g., 50 files, starting from the 10th):

curl "https://<your-agency>.smartmatchapp.com/api3/clients/<client_id>/files/?count=50&offset=10" \
    -u <token>: \
    -X GET
Request Parameters:

folder: (Optional) The ID of the folder to filter files by. If set to 0, only files not in any folder will be returned. If not provided, all files will be returned.

count: (Optional) The number of results to display in the response. The default is 20.

offset: (Optional) The offset from the beginning of the list. This allows you to paginate through the results.

Note: count and offset in the response echo the values you requested, not the size of the returned page. The last page can contain fewer than count items — compare offset plus the length of objects against total_count to detect the end of the list.

Example Success Response:
{
    "count": 20,
    "offset": 0,
    "total_count": 2,
    "objects": [
        {
            "id": 1,
            "name": "file_1.jpg",
            "size": "0.02Mb"
        },
        {
            "id": 2,
            "name": "file_2.jpg",
            "size": "0.02Mb",
            "folder": {
                "id": 13,
                "name": "folder 1"
            }
        }
    ]
}

If a file is not in any folder, the folder key will not be present in the response.

Base Request:

Method: GET

Authentication: Basic Authentication. Requires a valid <token> passed.

Rate Limits:

30 requests within 10 seconds

Error Responses:
401 Unauthorized

This error occurs when the <token> is missing, invalid, or the API access is disabled.

Possible errors: "not authenticated" or "token is disabled" or "Agency API is disabled"

404 Not Found

This error occurs if the client or the specified folder does not exist.
Possible errors: "object does not exist"

405 Method Not Allowed

This error occurs if an HTTP method other than GET is used (e.g., POST or PUT).
Possible errors: "wrong method"

429 Too Many Requests

This error occurs when the client has sent too many requests in a given amount of time, leading to rate limiting by the server.

Possible errors: "too many requests"

500 Server Error

Possible errors: "Internal server error"