# List Streams for Enterprise

Returns a list of all the streams (IMs, chatrooms, Wall posts as well as streams reserved for internal use) for the calling user's company, sorted by creation date (ascending – oldest to newest).&#x20;

**Filtering** parameters can be used to narrow the list of streams that are returned. For more information, refer to the **Filtering Returned Streams** section below.

## POST /v2/admin/streams/list

> Retrieve all the streams across the enterprise where the membership of the stream has been modified between a given time range<br>

```json
{"openapi":"3.1.1","info":{"title":"Pod API","version":"20.17.1"},"servers":[{"url":"http://yourpodURL.symphony.com/pod"}],"paths":{"/v2/admin/streams/list":{"post":{"summary":"Retrieve all the streams across the enterprise where the membership of the stream has been modified between a given time range\n","parameters":[{"schema":{"type":"string"},"name":"sessionToken","description":"Session authentication token.","in":"header","required":true},{"schema":{"type":"integer"},"name":"skip","description":"Number of items to skip. Default is 0.\n","in":"query"},{"schema":{"type":"integer"},"name":"limit","description":"Maximum number of items to return. Default is 50.  This value cannot exceed 100.\n","in":"query"}],"tags":["Streams"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2AdminStreamList"}}}},"400":{"description":"Client error, see response body for further details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized: Invalid session token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Forbidden: Caller lacks necessary entitlement.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error, see response body for further details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2AdminStreamFilter"}}},"description":"Stream filtering criteria."}}}},"components":{"schemas":{"V2AdminStreamList":{"description":"list of streams info","type":"object","properties":{"count":{"type":"integer","format":"int64","description":"total number of streams which match the filter criteria"},"skip":{"type":"integer","description":"number of streams skipped"},"limit":{"type":"integer","description":"maximum number of streams return"},"filter":{"$ref":"#/components/schemas/V2AdminStreamFilter"},"streams":{"$ref":"#/components/schemas/V2AdminStreamInfoList"}}},"V2AdminStreamFilter":{"description":"stream filter criteria","type":"object","properties":{"streamTypes":{"description":"type of streams to search for","type":"array","items":{"description":"Valid values are IM, MIM or ROOM","$ref":"#/components/schemas/V2AdminStreamType"}},"scope":{"description":"Scope of the room. Valid values are INTERNAL or EXTERNAL.\nIf not specified, it will include both Internal and External scope\n","type":"string"},"origin":{"description":"Origin of the room. It indicates whether the room was created by a user within the company by another company.\nValid values are INTERNAL or EXTERNAL.\nIf not specified, it will include both Internal and External origin\n","type":"string"},"status":{"description":"Status of the room.\nValid values are ACTIVE or INACTIVE.\nIf not specified, it will include both Active and Inactive status\n","type":"string"},"privacy":{"description":"Privacy setting of the stream.\nValid values are PUBLIC or PRIVATE.\nIf not specified, it will include both public and private streams\n","type":"string"},"startDate":{"description":"Start date in unix timestamp in millseconds","type":"integer","format":"int64"},"endDate":{"description":"End date in unix timestamp in millseconds.  If not specified, it assume to be current time.","type":"integer","format":"int64"}}},"V2AdminStreamType":{"type":"object","properties":{"type":{"type":"string"}}},"V2AdminStreamInfoList":{"type":"array","description":"list of stream info","items":{"$ref":"#/components/schemas/V2AdminStreamInfo"}},"V2AdminStreamInfo":{"description":"Stream information","type":"object","properties":{"id":{"type":"string","description":"stream id"},"isExternal":{"type":"boolean","description":"true indicate this stream has the scope of external and false indictate this stream has the scope of internal. Deprecated, use origin"},"isActive":{"type":"boolean","description":"true indicate that this stream has the status of active and false indicate this stream has the scope of inactive"},"isPublic":{"type":"boolean","description":"true indicate that this stream has a privacy setting of public.  This only apply a ROOM stream type."},"type":{"type":"string","description":"type of stream (IM, MIM, ROOM)"},"crossPod":{"type":"boolean","description":"If true, this is a cross-pod stream."},"origin":{"type":"string","description":"INTERNAL if the creator of this stream belongs to the pod, EXTERNAL otherwise"},"attributes":{"$ref":"#/components/schemas/V2AdminStreamAttributes"}}},"V2AdminStreamAttributes":{"description":"additional optional properties for the stream","type":"object","properties":{"roomName":{"type":"string","description":"room name (room only)"},"roomDescription":{"type":"string","description":"description of the room (room only)"},"members":{"type":"array","description":"list of userid who is member of the stream - im or mim only","items":{"type":"integer","format":"int64"}},"createdByUserId":{"type":"integer","format":"int64","description":"creator user id"},"createdDate":{"type":"integer","format":"int64","description":"created date"},"lastModifiedDate":{"type":"integer","format":"int64","description":"last modified date"},"originCompany":{"type":"string","description":"company name of the creator"},"originCompanyId":{"type":"integer","description":"company id of the creator"},"membersCount":{"type":"integer","description":"total number of members in the stream"},"lastMessageDate":{"type":"integer","format":"int64","description":"last date a message was sent in this stream"},"groupChat":{"type":"boolean","description":"whether a stream is a group chat or not. Since SBE 20.16."}}},"Error":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}}}
```

### Request Example

```bash
curl -X POST \
https://acme.symphony.com/pod/v2/admin/streams/list \
    -H 'Content-Type: application/json' \ 
    -H 'sessionToken: SESSION_TOKEN' \ 
    -d '{
          "streamTypes": [
            {"type": "IM"},
            {"type": "MIM"},
            {"type": "ROOM"},
            {"type": "POST"}
          ]
        }'
```

> #### 🚧 Required Permissions
>
> This endpoint may only be called by Service User accounts with the User Provisioning role.

{% hint style="info" %}
**Required Permissions:** This endpoint may only be called by Service User accounts with the User Provisioning role.
{% endhint %}

{% hint style="warning" %}
The property `attributes.originCompany` may be missing, in the rare event where the company owning the cross pod stream is no longer a Symphony customer.
{% endhint %}

Note: visit [Overview](https://docs.developers.symphony.com/building-bots-on-symphony/datafeed/overview-of-streams) for an overview of streams.

### Filtering Returned Streams

You can filter the streams that are returned by specifying optional body parameters.

For instance, the filter below would return active external chatrooms created by users who do not belong to your firm, created between Mon, 12 Dec 2016 20:37:36.047 GMT and Thu, 29 Dec 2016 19:01:29.833 GMT.

```json
{
	"streamTypes": [{"type": "ROOM"}],
	"scope": "EXTERNAL",
	"origin": "EXTERNAL",
	"privacy": "PRIVATE",
	"status": "ACTIVE",
	"startDate": 1481575056047,
	"endDate": 1483038089833
}
```

> #### 📘 lastMessageDate
>
> This is the date that the last message was sent in that room. The time is in epoch format.

> #### 📘 Scope vs. Origin
>
> The `scope` property refers to the participants of the room: whether the room contains only users within the company (internal scope) or whether the room contains users within the company as well as users belonging to another company (external scope). The scope property can apply to IMs and MIMs as well.
>
> The `origin` property applies only to rooms with external scope. Origin refers to the creator of the room with external scope: whether the room was created by a user of the company (internal origin) or whether the room was created by a user belonging to another company (external origin).
>
> A room with external scope and internal origin would be a room created by a user within the company, where members can belong to both the origin company and one other company.
>
> The response has defined variable "isExternal", and for external scope, can have two values {true, false}. This value is false, whenever the stream is created by an internal user.

> #### 📘 Privacy
>
> The `privacy` property applies only to rooms with internal scope. It refers to the privacy setting of the internal room: whether members (who must belong to the same company) must be added to the room or whether anyone in the company can find and join the room.
>
> External rooms are always private - members must be added to the room.

> #### 📘 Date Range Filter
>
> The `startDate` and `endDate` properties can be used to filter the list of streams to return only streams that were modified within the specified time range.
>
> For rooms, modification entails a change of room properties (ex. name or description updated, settings changed) or a change in room membership (ex. users added/removed, roles changed). Modification does not include message activity.
>
> IMs and MIMs are immutable - there can be no membership changes or properties changes. Therefore, filtering is performed upon the stream creation date.
>
> If neither `startDate` nor `endDate` are specified, all rooms since the beginning of the enterprise's time until the time of call are returned.
>
> If `startDate` is specified, but not endDate, all rooms modified since the startDate until the time of call are returned.
>
> If `endDate` is specified, but not `startDate`, all rooms modified since the beginning of the enterprise's time until the endDate are returned.
