---
title: "Updates a correlation."
method: PATCH
path: "/datasources/uid/{sourceUID}/correlations/{correlationUID}"
tags: ["datasources", "correlations"]
---

# Updates a correlation.

`PATCH /datasources/uid/{sourceUID}/correlations/{correlationUID}`

## Request

- Base URL: `/api` (relative, and the document’s source URL is not known)
- URL: `/api/datasources/uid/{sourceUID}/correlations/{correlationUID}`
- Auth: one of:
  - HTTP basic
  - API key in header `Authorization`

## Path parameters

- `sourceUID` string, required
- `correlationUID` string, required

## Request body

- UpdateCorrelationCommand: UpdateCorrelationCommand is the command for updating a correlation
  - `config` CorrelationConfigUpdateDTO
    - `field` string: Field used to attach the correlation link
    - `target` object: Target data query
    - `transformations` Transformation[]: Source data transformations
      - `expression` string
      - `field` string
      - `mapValue` string
      - `type` 'regex' | 'logfmt'
  - `description` string: Optional description of the correlation
  - `label` string: Optional label identifying the correlation
  - `type` string: the type of correlation, either query for containing query information, or external for containing an external URL +enum

## Response `200`

(empty)

- UpdateCorrelationResponseBody
  - `message` string
  - `result` Correlation: Correlation is the model for correlations definitions
    - `config` CorrelationConfig
      - `field` string, required: Field used to attach the correlation link
      - `target` object, required: Target data query
      - `transformations` Transformation[]
        - `expression` string
        - `field` string
        - `mapValue` string
        - `type` 'regex' | 'logfmt'
      - `type` string: the type of correlation, either query for containing query information, or external for containing an external URL +enum
    - `description` string: Description of the correlation
    - `label` string: Label identifying the correlation
    - `orgId` integer: OrgID of the data source the correlation originates from
    - `provisioned` boolean: Provisioned True if the correlation was created during provisioning
    - `sourceUID` string: UID of the data source the correlation originates from
    - `targetUID` string: UID of the data source the correlation points to
    - `type` string: the type of correlation, either query for containing query information, or external for containing an external URL +enum
    - `uid` string: Unique identifier of the correlation

## Other responses

- `400`: BadRequestError is returned when the request is invalid and it cannot be processed.
- `401`: UnauthorizedError is returned when the request is not authenticated.
- `403`: ForbiddenError is returned if the user/token has insufficient permissions to access the requested resource.
- `404`: NotFoundError is returned when the requested resource was not found.
- `500`: InternalServerError is a general error indicating something went wrong internally.

---

[API](https://skmtc.dev/grafana/apis/grafana-http-api.md) - [All operations](https://skmtc.dev/grafana/apis/grafana-http-api/llms.txt) - [OpenAPI document](https://skmtc.dev/grafana/apis/grafana-http-api/revisions/df55ba1718ba?raw)
