# Conversation views
Conversation views are simply saved search filters so you can easily and quickly filter your conversations with just a single click.
# The view object
- id integer- The system-generated ID of the view 
- account_id integer- The account id where the view belongs to. 
- user_id integer- The user id the conversation view belongs to. If - null, the view is considered to be available to all users.
- name string- The name of the view. 
- filter object- The view filters used to filter the conversations list. 
- created_at string- The timestamp when the view was created. 
- updated_at string- The timestamp when the view was last updated. 
# The view object
{
  "id": 1,
  "account_id": 1,
  "user_id": null,
  "name": "Unassigned",
  "filter": {
    "agent": "unassigned"
  },
  "updated_at": "2019-04-23T21:37:42+00:00",
  "created_at": "2019-04-23T21:37:42+00:00"
} 
# Create a view
Note
When you create a conversation view, it is automatically associated with you (i.e., user_id has your ID). At the moment, all views are available to all users in the account.
- name string required- The name of the view. 
- filter object required- The view filters used to filter the conversations list. 
# Sample request
curl https://www.yourdomain.com/api/v1/accounts/1/conversation-views \
  --request POST \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <access-token>" \
  -d name="Mine / All" \
  -d filters[agent]="me"
# Sample successful response
{
  "data": {
    "id": 1,
    "account_id": 1,
    "user_id": 1,
    "name": "Mine / All",
    "filter": {
      "agent": "me"
    },
    "updated_at": "2019-04-23T21:37:42+00:00",
    "created_at": "2019-04-23T21:37:42+00:00"
  } 
}
# Retrieve a view
# Sample request
curl https://www.yourdomain.com/api/v1/accounts/1/conversation-views/1 \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <access-token>" \
  -G
# Sample successful response
{
  "data": {
    "id": 1,
    "account_id": 1,
    "user_id": 1,
    "name": "Mine / All",
    "filter": {
      "agent": "me"
    },
    "updated_at": "2019-04-23T21:37:42+00:00",
    "created_at": "2019-04-23T21:37:42+00:00"
  } 
}
# Update a view
- name string required- The name of the view. 
- filter object required- The view filters used to filter the conversations list. 
# Sample request
curl https://www.yourdomain.com/api/v1/accounts/1/conversation-views/1 \
  --request PUT \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <access-token>" \
  -d name="Mine / Open" \
  -d filters[agent]="me" \
  -d filters[status][]="posted" \
  -d filters[status][]="pending"
# Sample successful response
{
  "data": {
    "id": 1,
    "account_id": 1,
    "user_id": 1,
    "name": "Mine / Open",
    "filter": {
      "agent": "me",
      "status": ["posted", "pending"]
    },
    "updated_at": "2019-04-23T21:37:42+00:00",
    "created_at": "2019-04-23T21:37:42+00:00"
  } 
}
# Delete a view
# Sample request
curl https://www.yourdomain.com/api/v1/accounts/1/conversation-views/1 \
  --request DELETE \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <access-token>" 
If successful, the above request will return an empty response with 204 HTTP status code.
# List all views
# Sample request
curl https://www.yourdomain.com/api/v1/accounts/1/views \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <access-token>" \
  -G
# Sample successful response
{
  "data": [
    {
      "id": 1,
      "account_id": 1,
      "user_id": null,
      "name": "Mine / Open",
      "filter": {
        "agent": "me",
        "status": ["posted", "pending"]
      },
      "updated_at": "2019-04-23T21:37:42+00:00",
      "created_at": "2019-04-23T21:37:42+00:00"
    } ,
    {...}
  ]
}
