# Create source link

`POST /v1/operations/configLinks/sources/{sourceId}`

Available as MCP tool `create-source-link` (Write).

Config endpoints allow you to review metadata of available Redox base configs and related source links. [Learn about mapping operations](https://docs.redoxengine.com/permalink/Wxms74JvgjSCtaPnJdNFD/#mapping-and-modifying-operations).

Base configs can be linked to sources within your Redox organization to convert a payload from a one data format to the appropriate Redox data model or FHIR resource.

Anyone in a Redox organization can view metadata of base configs and source links. However, only a Redoxer can view or modify the content of base configs, and only a user assigned to an engineer or support role can manage source links. 

You can:

- retrieve a list of available base configs;
- retrieve a list of links attached to a source;
- create base config links to sources;
- update base config links to sources; or
- delete base config links to sources.

### Create source link

Link a base config to the specified source. You can link the same base config to multiple sources.

## Request parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `sourceId` | path | string | Yes | Displays the unique identifier of a source within a given environment. |

## Request body

Defines the metadata for creating a new base config link.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `configId` | string (uuid) | Yes | Displays the unique identifier of the base config being linked to the source. |
| `version` | string (uuid) | Yes | Specifies the version of the base config to use. If not provided, uses the same value as configId. |
| `dataModel` | string | Yes | Identifies the Redox data model that this config link applies to. |
| `processingLocation` | string | No | Specifies where the base config should be applied, whether to the request or response side of the data exchange. If not provided, the default is request. The processing location can't be changed once the base config link is created. Possible values: request, response |
| `eventType` | string, nullable | No | Specifies the event types of the given Redox data model that the link applies to. If `null`, the config is linked to all event types of the data model. |

## Request example

_Generated from the schema: the values are placeholders, not a real payload._

```bash
curl 'https://api.redoxengine.com/platform/v1/operations/configLinks/sources/{sourceId}' \
--request POST \
--header 'Authorization: Bearer $API_TOKEN' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
  "configId": "f84d602d-7449-4a13-b9a4-8688cae85726",
  "processingLocation": "request",
  "version": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "dataModel": "Provider",
  "eventType": "New"
}'
```

## Responses

### 200

Contains a payload object with a base config link and its related details.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `meta` | object | No |  |
| `meta.version` | string | No | Lists the major and minor version number for the format of the returned payload. The payload format or shape may change between minor versions, like including additional or extended fields in later versions. We include the version data in each response so that you have the option to handle the signaled differences. |
| `payload` | object | No | Contains the details about the specified base config link. |
| `payload.configLink` | object | No | Contains a base config link and its related details. |
| `payload.configLink.id` | string (uuid) | No | Displays the unique identifier of the link between the source and base config. |
| `payload.configLink.configId` | string (uuid) | No | Displays the unique identifier of the base config being linked to the source. |
| `payload.configLink.processingLocation` | string | No | Indicates whether the base config applies to request or response processing. Possible values: request, response |
| `payload.configLink.version` | string (uuid) | No | Specifies the version of the base config being used. |
| `payload.configLink.dataModel` | string | No | Identifies the Redox data model that this config link applies to. |
| `payload.configLink.eventType` | string, nullable | No | Specifies the event types of the given Redox data model that the link applies to. If `null`, the config is linked to all event types of the data model. |

_Generated from the schema: the values are placeholders, not a real payload._

```json
{
  "meta": {
    "version": "1.0.0"
  },
  "payload": {
    "configLink": {
      "id": "dc5d2a43-df19-459c-b14f-450584ce1c55",
      "configId": "f84d602d-7449-4a13-b9a4-8688cae85726",
      "processingLocation": "request",
      "version": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "dataModel": "Provider",
      "eventType": "New"
    }
  }
}
```

### 400

Bad Request

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `payload` | object | No | Contains the error message. |
| `payload.error` | object | No | Contains the error message details. |
| `payload.error.id` | string | No | Contains a unique identifier for the given error instance. |
| `payload.error.title` | string | No | Displays the high-level error message, typically something succinct like `Bad Request`. |
| `payload.error.code` | string | No | Contains an alternative ID for the error type, which can be used to find relevant troubleshooting information. |
| `payload.error.detail` | string | No | Contains the specific error details for this message. |
| `payload.error.status` | number | No | Displays the corresponding HTTP status code for the error. |
| `payload.error.transient` | boolean | No | Describes whether the error will resolve itself. If `true`, no further action needs to be taken. If `false`, you may need to troubleshoot on your end to resolve the issue before the error can be processed. |

```json
{
  "payload": {
    "error": {
      "title": "Bad Request",
      "code": "validation.error.bad.request",
      "detail": "Error details",
      "status": 400,
      "transient": false
    }
  }
}
```

### 403

Forbidden

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `payload` | object | No | Contains the error message. |
| `payload.errors` | Array of object | No |  |
| `payload.errors[].title` | string | No | Displays the high-level error message, typically something succinct like `Forbidden`. |
| `payload.errors[].code` | string | No | Contains an alternative ID for the error type, which can be used to find relevant troubleshooting information. |

```json
{
  "payload": {
    "errors": [
      {
        "title": "Forbidden",
        "code": "authorization.forbidden"
      }
    ]
  }
}
```

### 500

Internal Server Error

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `payload` | object | No | Contains the error message. |
| `payload.error` | object | No | Contains the error message details. |
| `payload.error.title` | string | No | Displays the high-level error message, typically something succinct like `Failed in step X`. |
| `payload.error.code` | string | No | Contains an alternative ID for the error type, which can be used to find relevant troubleshooting information. |
| `payload.error.detail` | string | No | Contains the specific error details for this message. |
| `payload.error.status` | number | No | Displays the corresponding HTTP status code for the error. |
| `payload.error.transient` | boolean | No | Describes whether the error will resolve itself. If `true`, no further action needs to be taken. If `false`, you may need to troubleshoot on your end to resolve the issue before the error can be processed. |

```json
{
  "payload": {
    "error": {
      "title": "Internal Server Error",
      "code": "failed.db.lookup",
      "detail": "Error details",
      "status": 500,
      "transient": true
    }
  }
}
```
