Skip to main content
PATCH
/
connections
/
metadata
Edit connection metadata
curl --request PATCH \
  --url https://api.nango.dev/connections/metadata \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "connection_id": "connection-123",
  "provider_config_key": "<string>",
  "metadata": {}
}
'
import requests

url = "https://api.nango.dev/connections/metadata"

payload = {
"connection_id": "connection-123",
"provider_config_key": "<string>",
"metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({connection_id: 'connection-123', provider_config_key: '<string>', metadata: {}})
};

fetch('https://api.nango.dev/connections/metadata', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nango.dev/connections/metadata",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'connection_id' => 'connection-123',
'provider_config_key' => '<string>',
'metadata' => [

]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.nango.dev/connections/metadata"

payload := strings.NewReader("{\n \"connection_id\": \"connection-123\",\n \"provider_config_key\": \"<string>\",\n \"metadata\": {}\n}")

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.patch("https://api.nango.dev/connections/metadata")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"connection_id\": \"connection-123\",\n \"provider_config_key\": \"<string>\",\n \"metadata\": {}\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.nango.dev/connections/metadata")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"connection_id\": \"connection-123\",\n \"provider_config_key\": \"<string>\",\n \"metadata\": {}\n}"

response = http.request(request)
puts response.read_body
{
  "connection_id": "connection-123",
  "provider_config_key": "<string>",
  "metadata": {}
}
{
"message": "<string>"
}
Requires an API key with the environment:connections:update scope. Learn more about API key scopes.

Update connection metadata

Nango uses the request body as the new metadata (it must be a JSON object). Note that this overrides specified properties, not the entire metadata. The connection_id must be passed in the body as well. Note that the connection_id can be a single string or an array of strings.

Fetching connection metadata

To read the existing metadata of a connection, simply fetch the connection. Your custom metadata is included as part of the returned connection object.

Authorizations

Authorization
string
header
required

The secret key from your Nango environment.

Body

application/json
connection_id
required

The connection ID used to update the metadata on. Accepts an array of connection ids as well

Example:

"connection-123"

provider_config_key
string
required

The integration ID used to create the connection (aka Unique Key).

metadata
object
required

Response

Successfully updated the metadata for the connections

connection_id

The connection ID used to update the metadata on. Returns an array of connection ids if an array is passed in.

Example:

"connection-123"

provider_config_key
string

The integration ID used to create the connection (aka Unique Key).

metadata
object