# Update Source

> Media API · Sources

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

Update a source. To learn more about sources, read [Content and sources](doc:content-and-sources#sources).

RBAC Capability Required: `flow.source.update`

## Authentication

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

## Path parameters

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

## Request body

Content type: `application/json`

- `metadata` · object · Optional — Resource metadata.
  - `displayName` · string · Optional · _1-255 characters_ — A human-readable name for the resource.
  - `labels` · map from strings to string · Optional — A dictionary of labels associated with the resource. Maximum number of labels: 32. Maximum length of a label or value: 256 characters. Label: alphanumeric, hyphens and underscores. Value: alphanumeric, hyphens, underscores and spaces.
    - `[any key]` · string — map of additional properties
- `spec` · object · Optional
  - `contentName` · string or null · Optional · _pattern: ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$_ — Name of the <<glossary:content>> that this source should carry. Set to null to ungroup the source from content.
  - `transport` · object · Optional
    - `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):
    - `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.
    - `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.
    - `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.

## Example request

```bash
curl -X PATCH "https://app.mk.io/api/v1/projects/{project_name}/media/sources/{name}" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
  "metadata": {
    "displayName": "string",
    "labels": {
      "key": "string"
    }
  },
  "spec": {
    "contentName": "sports1",
    "transport": {
      "allowList": [
        "string"
      ],
      "passPhrase": "",
      "password": "string",
      "url": "string",
      "user": "string"
    }
  }
}'
```

## Responses

### 200 — The updated source

- `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
{
  "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
}
```

### 409 — Source content cannot be changed while the source is in use by a running flow.

- `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: `[patch]_/api/v1/projects/{project_name}/media/sources/{name}`
