# List Sources

> Media API · Sources

```http
GET https://app.mk.io/api/v1/projects/{project_name}/media/sources
```

List sources on the specified project. To learn more about sources, read [Content and sources](doc:content-and-sources#sources).

## Listing, Sorting and Filtering Sources

This endpoint returns the list of sources in the specified project.

### Sorting

The results from this endpoint can be ordered using the `$orderby` query parameter. Specify a list of field names, separated by commas
where each one can optionally specify `asc` or `desc`.

Sorting is valid on the following fields: `created`, `createdBy`, `displayName`, `id`, `labels`, `name`, `status/state`, `updated`, `updatedBy`

### Filtering

There are two ways to filter the set of returned sources from this endpoint - the first is to use the `$filter` query parameter, the second is to use the
`$label_key` and `$label` query parameters.

The `$filter` query parameter allows for sources to be filtered on the basis of fields in the schema using OData query syntax.
See [this document](https://learn.microsoft.com/en-us/odata/concepts/queryoptions-overview#filter) for more details on the syntax used.

Filters are valid on the following fields: `created`, `createdBy`, `createdByEmail`, `createdByName`, `displayName`, `id`, `labels`, `name`, `spec/contentName`, `spec/transport/type`, `status/state`, `updated`, `updatedBy`, `updatedByEmail`, `updatedByName`

`$label_key` and `$label` are specific to querying sources based on their labels. Labels are a set of key-value pairs that can be used to identify sources with
any arbitrary metadata you want, specifically for the purpose of retrieving relevant subsets of sources.

### Examples:

`?$top=10` - Returns only the first 10 sources from the list.

`?$orderby=name desc` - Sorts sources by name in descending order.

`?$filter=name eq 'descriptive name'` - Returns sources that match the provided name.

`?$orderby=created desc` - Sorts sources by creation date in descending order.

`?$filter=created ge 2021-01-01T00:00:00Z` - Returns sources created after January 1, 2021.

`?$label=studio=paravalley` - Returns sources with the label `studio` set to `paravalley`.

`?$label=release-date~2023` - Returns sources with the label `release-date` set to a value that contains `2023`.

`?$label_key=studio&label_key=release-date` - Returns sources with any value set for the `studio` label and the `release-date` label.

RBAC Capability Required: `flow.source.get`

## Authentication

- `Authorization` header — Bearer authentication of the form `Bearer <token>`.

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `project_name` | string | Yes | — |

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `$orderby` | string | No | Specifies the key by which the result collection should be ordered. |
| `$filter` | string | No | Restricts the set of items returned. |
| `$top` | string | No | Specifies a non-negative integer `n` that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value `n`. |
| `$skiptoken` | string | No | Specifies a start offset to support paginated results. Use `@odata.nextLink` in the result object to enumerate the collection - it will be present only if there's more than one page of entities. |
| `$label_key` | string | No | Filters the set to the specified label key. If multiple $label_keys are specified, matching items must have all labels. |
| `$label` | string | No | Filters the set to the specified label key/value pair. Supports equality, inequality, and inexact matching. If multiple values are provided for the same key, items matching either value will be returned. |

## Example request

```bash
curl -X GET "https://app.mk.io/api/v1/projects/{project_name}/media/sources" \
  -H "Authorization: Bearer <token>"
```

## Responses

### 200 — List of sources

- `@odata.nextLink` · string · Optional — @odata.nextLink URL if the page length and number of items match.
- `supplemental` · object · **Required** — Supplemental info
  - `count` · integer · **Required** — Number of items returned
  - `kind` · string · **Required** — Type of items in the list
  - `operation` · string · **Required** — Operation type. Should always say 'list'
  - `pagination` · object · **Required** — Pagination info
    - `end` · integer · **Required** — Position of the last item in the list
    - `records` · integer · **Required** — Total number of items returned in the list
    - `start` · integer · **Required** — Position of the first item in the list
    - `total` · integer · **Required** — Total number of items in the project
  - `subscription` · object · Optional — Project info
    - `id` · string · **Required** — Project ID
    - `name` · string · **Required** — Project name
- `value` · list of objects · **Required** — A list of sources.
  - Array items (object):
    - `kind` · string · **Required** — The kind of record.
    - `metadata` · object · **Required** — Source metadata.
      - `created` · string · Optional · _format: date-time_ — The time when the resource was created
      - `createdBy` · string · Optional · _format: uuid_ — ID of the user who created the resource
      - `createdByEmail` · string · Optional — Email of the user who created the resource
      - `displayName` · string · Optional — The display name of the resource
      - `id` · string · **Required** · _format: uuid_ — The ID of the resource
      - `labels` · map from strings to string · Optional — A dictionary of labels associated with the resource
        - `[any key]` · string — map of additional properties
      - `name` · string · Optional — The name of the resource
      - `updated` · string · Optional · _format: date-time_ — The time when the resource was last updated
      - `updatedBy` · string · Optional · _format: uuid_ — ID of the user who last updated the resource
      - `updatedByEmail` · string · Optional — Email of the user who last updated the resource
    - `spec` · object · **Required** — Source specification.
      - `contentName` · string or null · Optional · _pattern: ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$_ — Name of the <<glossary:content>> that will be carried by this source. If omitted, the source can only be used via a direct sourceName reference in a flow input. Use source PATCH to change this association or set it to null to ungroup the source.
      - `networkName` · string · Optional · _pattern: ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$_ — Name of the <<glossary:network>> that this source is available on. Only <<glossary:flow>>s that can reach this network will be able to resolve content to this source; read about [Resolving content](doc:content-and-sources#resolving-content) to learn more. This field cannot be modified, only set during creation.
      - `transport` · object · **Required** — Details of the <<glossary:transport>> that the content will be carried on. To learn more about the kinds of transport that can be configured, read [Set up transports on sources and destinations](doc:set-up-transports). Most transport fields are set at creation. The source PATCH contract defines the fields that can be updated for each transport type.
        - `allowList` · list of strings · Optional — List of IP addresses that are allowed to connect, if the transport type supports it. The following transport types can use the `allowList` field: `SRTListener`.
          - Array items (string):
        - `encryptionStandard` · enum · Optional · _Defaults to None_ — Encryption standard for the transport, if the transport type supports it. The following transport types can use the `encryptionStandard` field: `SRTCaller`, `SRTListener`. This field cannot be modified, only set during creation.
          - Allowed values: `None`, `AES128`, `AES192`, `AES256`
        - `ipResource` · object · Optional — Add an IP resource reservation for the transport. This is necessary for <<glossary:source>>s and <<glossary:destination>>s that need to access a <<glossary:SaaS site>> through a public IP address or public URL. The following transport types can use the `ipResource` field: `SRTListener`. This field cannot be modified, only set during creation.
          - `type` · enum · **Required** — Type of IP resource reservation: - `External` means reserve a public IP address, - `Internal` means reserve an internal IP address (please contact MediaKind personnel for usage), and - `None` means don't try to reserve an IP resource. Transports between on-prem devices don't need to explicitly reserve an IP address.
            - Allowed values: `None`, `External`, `Internal`
        - `latency` · double · Optional · _Defaults to 0.5_ — Minimum Latency, in seconds, for the transport, if the transport type supports it. The following transport types can use the `latency` field: `SRTCaller`, `SRTListener`. This field cannot be modified, only set during creation.
        - `maxBitrate` · integer · Optional · _Defaults to 30000000_ — Maximum bitrate, in bits per second, expected through each individual connection to the Listener. The following transport types can use the `maxBitrate` field: `SRTCaller`, `SRTListener`. This field cannot be modified, only set during creation.
        - `maxConnections` · integer · Optional · _Defaults to 10_ — Maximum number of connections for a Listener destination. Overrides the flow output maxConnections setting if present. The following transport types can use the `maxConnections` field: `SRTCaller`, `SRTListener`. This field cannot be modified, only set during creation.
        - `maxOverheadBandwidth` · integer · Optional · _5 to 100_ · _Defaults to 100_ — Maximum Overhead Bandwidth, as an integer (e.g., 100), for the transport, if the transport type supports it. The following transport types can use the `maxOverheadBandwidth` field: `SRTCaller`, `SRTListener`. This field cannot be modified, only set during creation.
        - `passPhrase` · string · Optional · _Defaults to _ — Password phrase for the transport, if the transport type supports it. The following transport types can use the `passPhrase` field: `SRTCaller`, `SRTListener`.
        - `password` · string · Optional — Password for HLS pull authentication. For sources, this field can be updated via PATCH when the transport type is `HLSPullInput`. For all other transport types, it can only be set during creation.
        - `port` · integer · Optional · _Defaults to 5000_ — Port for the transport, if the transport type supports it. The following transport types need the `port` field: `SRTListener`. This field cannot be modified, only set during creation.
        - `streamId` · string · Optional · _Defaults to _ — The SRT stream ID sent by the caller during the SRT handshake. Used by the listener to identify or route the stream. Optional. The following transport types can use the `streamId` field: `SRTCaller`. This field cannot be modified, only set during creation.
        - `streamKey` · string · Optional · _Defaults to _ — The RTMP stream key (appended to the URL when connecting). The following transport types need the `streamKey` field: `RTMPPushOutput`. This field cannot be modified, only set during creation.
        - `type` · enum · **Required** — Type of transport. This field cannot be modified, only set during creation.
          - Allowed values: `UDP`, `SDI`, `SRTCaller`, `SRTListener`, `HLSPullInput`, `RTMPPushOutput`
        - `url` · string · Optional — The URL for the transport, if the transport type supports it. The following transport types need the `url` field: `SRTCaller`, `UDP`, `SDI`, `HLSPullInput`, `RTMPPushOutput`. For sources, this field can be updated via PATCH when the transport type is `SRTCaller` or `HLSPullInput`. For all other transport types, and for destinations, it can only be set during creation.
        - `urls` · list of strings · Optional · **Deprecated** — DEPRECATED: Use `url` instead. This is provided for backwards compatibility and will be removed in a future release. If `urls` is used, only the first URL will be considered. If both `url` and `urls` are provided, `url` takes precedence.
          - Array items (string):
        - `user` · string · Optional — Username for HLS pull authentication. For sources, this field can be updated via PATCH when the transport type is `HLSPullInput`. For all other transport types, it can only be set during creation.
    - `status` · object · **Required** — Source status.
      - `networkDisplayName` · string · Optional — The display name of the network this source is available on.
      - `shortId` · string · Optional — An alternative short identifier for the source. This is used only for visual inspection and should not be used for any programmatic purposes.
      - `state` · enum · Optional · _Defaults to Inactive_ — Indicates if the source is currently in use by any active <<glossary:flow>>s.
        - Allowed values: `Inactive`, `Active`
      - `transport` · object · Optional — Transport status information for the source.
        - `urls` · list of strings · Optional — The URLs configured or allocated/discovered for the transport. Where the `spec.transport.url` field is supported by the transport `type` (e.g. an SRTCaller), the `urls` field will contain that data. Where the system automatically allocates/discovers one or more URLs (e.g. an SRTListener), the `urls` field will contain that data.
          - Array items (string):

Example:

```json
{
  "@odata.nextLink": "string",
  "supplemental": {
    "count": 0,
    "kind": "string",
    "operation": "string",
    "pagination": {
      "end": 0,
      "records": 0,
      "start": 0,
      "total": 0
    },
    "subscription": {
      "id": "string",
      "name": "string"
    }
  },
  "value": [
    {
      "kind": "string",
      "metadata": {
        "created": "2024-01-01T00:00:00Z",
        "createdBy": "00000000-0000-0000-0000-000000000000",
        "createdByEmail": "string",
        "displayName": "string",
        "id": "00000000-0000-0000-0000-000000000000",
        "labels": {
          "label1": "value1",
          "label2": "value2"
        },
        "name": "string",
        "updated": "2024-01-01T00:00:00Z",
        "updatedBy": "00000000-0000-0000-0000-000000000000",
        "updatedByEmail": "string"
      },
      "spec": {
        "contentName": "sports1",
        "networkName": "internet",
        "transport": {
          "allowList": [
            "string"
          ],
          "encryptionStandard": "None",
          "ipResource": {
            "type": "None"
          },
          "latency": 0.5,
          "maxBitrate": 30000000,
          "maxConnections": 10,
          "maxOverheadBandwidth": 100,
          "passPhrase": "",
          "password": "string",
          "port": 5000,
          "streamId": "",
          "streamKey": "",
          "type": "UDP",
          "url": "string",
          "urls": [
            "string"
          ],
          "user": "string"
        }
      },
      "status": {
        "networkDisplayName": "string",
        "shortId": "string",
        "state": "Inactive",
        "transport": {
          "urls": [
            "string"
          ]
        }
      }
    }
  ]
}
```

### 400 — Bad Request

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 401 — Unauthorized

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 403 — Forbidden

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 404 — Not Found

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 429 — Too Many Requests

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 500 — Internal Server Error

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

---

Source spec: `media-api` · operationId: `[get]_/api/v1/projects/{project_name}/media/sources`
