Update Sub-account API Key
const options = {
method: 'PATCH',
headers: {'X-Api-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({enabled: true})
};
fetch('https://api.mailchannels.net/tx/v1/sub-account/{handle}/api-key/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.mailchannels.net/tx/v1/sub-account/{handle}/api-key/{id}"
payload = { "enabled": True }
headers = {
"X-Api-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mailchannels.net/tx/v1/sub-account/{handle}/api-key/{id}",
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([
'enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request PATCH \
--url https://api.mailchannels.net/tx/v1/sub-account/{handle}/api-key/{id} \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <x-api-key>' \
--data '
{
"enabled": true
}
'Update Sub-account API Key
Enables or disables the API key identified by its ID for the specified sub-account.
A disabled API key cannot be used to authenticate requests until it is enabled again.
Currently, enabled is the only field that can be updated, and it must be included in the request body.
PATCH
/
sub-account
/
{handle}
/
api-key
/
{id}
Update Sub-account API Key
const options = {
method: 'PATCH',
headers: {'X-Api-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({enabled: true})
};
fetch('https://api.mailchannels.net/tx/v1/sub-account/{handle}/api-key/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.mailchannels.net/tx/v1/sub-account/{handle}/api-key/{id}"
payload = { "enabled": True }
headers = {
"X-Api-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mailchannels.net/tx/v1/sub-account/{handle}/api-key/{id}",
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([
'enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request PATCH \
--url https://api.mailchannels.net/tx/v1/sub-account/{handle}/api-key/{id} \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <x-api-key>' \
--data '
{
"enabled": true
}
'Path Parameters
Body
application/json
Response
The API key was successfully updated for the sub-account.
Was this page helpful?

