Trak Software Documentation logo

Accounts


GET /accounts

Query Parameters

Parameter Type Description
join String Values to join to account resource.
notifications Boolean Filter accounts by notifications flag.
search String Filter accounts by matching the account name.
status Integer Filter accounts by their status id. Pass multiple ids seperated by | character.
user Integer Filter accounts by users attached to the account. Pass multiple ids seperated by | character.

{primary} You can filter the accounts you're assocated with by passing me to the user parameter.

Joining Resources

Here is a list of available resources to join on accounts.

['author', 'author.avatar', 'logo', 'status', 'users', 'users.avatar']

Example Requests

All Accounts with their status with names like "foobar"

https://example.trak.io/api/v1/accounts?join=status&search=foobar

Account with ID 1 with their users

https://example.trak.io/api/v1/accounts/1?join=users

Example Response

{
    "success": true,
    "message": null,
    "data": {
        "current_page": 1,
        "data": [
            {
                "account_id": 1,
                "site_id": 1,
                "user_id": 1,
                "status_id": 1,
                "name": "Foo Bar",
                "notifications": 1,
                "logo": null,
                "created_at": "2018-12-07 19:53:20",
                "updated_at": "2019-01-07 19:12:02",
                "status_name": "Non-Collaborative",
                "status": {
                    "status_id": 1,
                    "site_id": 1,
                    "user_id": 1,
                    "name": "Collaborative",
                    "active": 1,
                    "collaborative": 1,
                    "created_at": "2019-02-09 01:48:37",
                    "updated_at": "2019-02-09 01:48:37"
                },
                "users": [
                    {
                        "user_id": 1,
                        "site_id": 1,
                        "group_id": 1,
                        "first": "Trak",
                        "last": "Admin",
                        "email": "admin@trak.io",
                        "avatar": null,
                        "terms": 0,
                        "active": 1,
                        "editor": 1,
                        "created_at": "2018-12-03 20:33:01",
                        "updated_at": "2019-02-13 16:54:18",
                        "login_at": "2019-02-13 16:54:18",
                        "pivot": {
                            "account_id": 1,
                            "user_id": 1,
                            "created_at": "2018-12-07 19:53:25",
                            "updated_at": "2018-12-07 19:53:25"
                        }
                    },
                    ...
                ]
            },
            ...
        ],
        "first_page_url": "https://example.trak.io/api/v1/accounts?page=1",
        "from": 1,
        "last_page": 1,
        "last_page_url": "https://example.trak.io/api/v1/accounts?page=1",
        "next_page_url": null,
        "path": "https://example.trak.io/api/v1/accounts",
        "per_page": 50,
        "prev_page_url": null,
        "to": 14,
        "total": 14
    }
}

POST /accounts

Query Parameters

Parameter Type Required Description
name String true The name of the account.
status_id Integer true The status of the account.
notifications Boolean false Flag to determine if the account should deliver notifications.

Example Requests

{
    "name": "Example Account",
    "status_id": 1,
    "notifications": true
}

Example Response

{
    "success": true,
    "message": "API_ACCOUNT_CREATED",
    "data": {
        "site_id": 1,
        "user_id": 1,
        "name": "Example Account",
        "status_id": "1",
        "notifications": "1",
        "updated_at": "2019-02-15 18:05:28",
        "created_at": "2019-02-15 18:05:28",
        "account_id": 1
    }
}

PUT /accounts/{account_id}

Query Parameters

Parameter Type Required Description
name String true The name of the account.
status_id Integer true The status of the account.
notifications Boolean false Flag to determine if the account should deliver notifications.

Example Requests

{
    "name": "Updated Account",
    "status_id": 1,
    "notifications": true
}

Example Response

{
    "success": true,
    "message": "API_ACCOUNT_UPDATED",
    "data": {
        "site_id": 1,
        "user_id": 1,
        "name": "Updated Account",
        "status_id": "1",
        "notifications": "1",
        "updated_at": "2019-02-15 18:12:00",
        "created_at": "2019-02-15 18:05:28",
        "account_id": 1
    }
}

DELETE /accounts/{account_id}

{danger} Deleting an account will delete all attached tasks, notes, and field data.

Example Response

{
    "success": true,
    "message": "API_ACCOUNT_DELETED",
    "data": []
}