---
title: "Add correlation."
method: POST
path: "/datasources/uid/{sourceUID}/correlations"
tags: ["correlations"]
---

# Add correlation.

`POST /datasources/uid/{sourceUID}/correlations`

## Path parameters

- `sourceUID` string, required

## Request body

- CreateCorrelationCommand — CreateCorrelationCommand is the command for creating a correlation
  - `config` CorrelationConfig
    - `field` string, required — Field used to attach the correlation link
    - `target` object, required — Target data query
    - `type` string, required
  - `description` string — Optional description of the correlation
  - `label` string — Optional label identifying the correlation
  - `targetUID` string — Target data source UID to which the correlation is created. required if config.type = query

## Response `200`

(empty)

- CreateCorrelationResponseBody — CreateCorrelationResponse is the response struct for CreateCorrelationCommand
  - `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
      - `type` string, required
    - `description` string — Description of the correlation
    - `label` string — Label identifying the correlation
    - `sourceUID` string — UID of the data source the correlation originates from
    - `targetUID` string — UID of the data source the correlation points to
    - `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/nforgeio/apis/grafana-http-api.md) · [All operations](https://skmtc.dev/nforgeio/apis/grafana-http-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/nforgeio/grafana-http-api/revisions/3cb6c3f42dc7/schema)
