Update
Update a secretβs metadata. Does not change the value: use the rotate action for that.
curl --request PUT \
--url https://api.incident.io/v2/secrets/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Auth token for the PagerDuty outgoing webhook",
"name": "PagerDuty webhook token",
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
]
}
'import requests
url = "https://api.incident.io/v2/secrets/{id}"
payload = {
"description": "Auth token for the PagerDuty outgoing webhook",
"name": "PagerDuty webhook token",
"owning_team_ids": ["01G0J1EXE7AXZ2C93K61WBPYEH"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
description: 'Auth token for the PagerDuty outgoing webhook',
name: 'PagerDuty webhook token',
owning_team_ids: ['01G0J1EXE7AXZ2C93K61WBPYEH']
})
};
fetch('https://api.incident.io/v2/secrets/{id}', 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.incident.io/v2/secrets/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'description' => 'Auth token for the PagerDuty outgoing webhook',
'name' => 'PagerDuty webhook token',
'owning_team_ids' => [
'01G0J1EXE7AXZ2C93K61WBPYEH'
]
]),
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.incident.io/v2/secrets/{id}"
payload := strings.NewReader("{\n \"description\": \"Auth token for the PagerDuty outgoing webhook\",\n \"name\": \"PagerDuty webhook token\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.incident.io/v2/secrets/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Auth token for the PagerDuty outgoing webhook\",\n \"name\": \"PagerDuty webhook token\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/secrets/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"Auth token for the PagerDuty outgoing webhook\",\n \"name\": \"PagerDuty webhook token\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"secret": {
"created_at": "2021-08-17T13:28:57.801578Z",
"description": "Auth token for the PagerDuty outgoing webhook",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"last_four_chars": "c123",
"name": "PagerDuty webhook token",
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
],
"updated_at": "2021-08-17T13:28:57.801578Z",
"version": 3
}
}Authorizations
API key from your incident.io dashboard (Settings β API keys)
Path Parameters
The secret's ID
"01FCNDV6P870EA6S7TK1DSYDG0"
Body
Human-readable name, unique within the organisation amongst unarchived secrets
"PagerDuty webhook token"
Optional description of what this secret is for
"Auth token for the PagerDuty outgoing webhook"
IDs of the teams that own this secret. When omitted, the existing owning teams are left unchanged.
["01G0J1EXE7AXZ2C93K61WBPYEH"]
Response
OK response.
A secret is a named credential that workflows can reference, for example an auth token for an outgoing webhook.
Its value can be set and rotated but never read back: the API stores it encrypted and only ever returns masked metadata (the last four characters of the current value). Update the value with the rotate action, which appends a new version and retires the previous one.
Show child attributes
Show child attributes
Was this page helpful?
curl --request PUT \
--url https://api.incident.io/v2/secrets/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Auth token for the PagerDuty outgoing webhook",
"name": "PagerDuty webhook token",
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
]
}
'import requests
url = "https://api.incident.io/v2/secrets/{id}"
payload = {
"description": "Auth token for the PagerDuty outgoing webhook",
"name": "PagerDuty webhook token",
"owning_team_ids": ["01G0J1EXE7AXZ2C93K61WBPYEH"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
description: 'Auth token for the PagerDuty outgoing webhook',
name: 'PagerDuty webhook token',
owning_team_ids: ['01G0J1EXE7AXZ2C93K61WBPYEH']
})
};
fetch('https://api.incident.io/v2/secrets/{id}', 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.incident.io/v2/secrets/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'description' => 'Auth token for the PagerDuty outgoing webhook',
'name' => 'PagerDuty webhook token',
'owning_team_ids' => [
'01G0J1EXE7AXZ2C93K61WBPYEH'
]
]),
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.incident.io/v2/secrets/{id}"
payload := strings.NewReader("{\n \"description\": \"Auth token for the PagerDuty outgoing webhook\",\n \"name\": \"PagerDuty webhook token\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.incident.io/v2/secrets/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Auth token for the PagerDuty outgoing webhook\",\n \"name\": \"PagerDuty webhook token\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/secrets/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"Auth token for the PagerDuty outgoing webhook\",\n \"name\": \"PagerDuty webhook token\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"secret": {
"created_at": "2021-08-17T13:28:57.801578Z",
"description": "Auth token for the PagerDuty outgoing webhook",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"last_four_chars": "c123",
"name": "PagerDuty webhook token",
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
],
"updated_at": "2021-08-17T13:28:57.801578Z",
"version": 3
}
}