Update inbox API key
curl --request PATCH \
--url https://api.openmail.sh/v1/inboxes/{id}/api-keys/{keyId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mailAccess": true
}
'import requests
url = "https://api.openmail.sh/v1/inboxes/{id}/api-keys/{keyId}"
payload = { "mailAccess": True }
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({mailAccess: true})
};
fetch('https://api.openmail.sh/v1/inboxes/{id}/api-keys/{keyId}', 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.openmail.sh/v1/inboxes/{id}/api-keys/{keyId}",
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([
'mailAccess' => true
]),
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.openmail.sh/v1/inboxes/{id}/api-keys/{keyId}"
payload := strings.NewReader("{\n \"mailAccess\": true\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.openmail.sh/v1/inboxes/{id}/api-keys/{keyId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"mailAccess\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openmail.sh/v1/inboxes/{id}/api-keys/{keyId}")
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 \"mailAccess\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"podId": "<string>",
"inboxId": "<string>",
"tokenPrefix": "<string>",
"last4": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"lastUsedAt": "2023-11-07T05:31:56Z",
"mailAccess": true
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Inboxes
Update inbox API key
Turn IMAP / SMTP access on or off for an inbox-scoped API key. With access on, mail apps sign in with the inbox address as the username and the key as the password. Turning it off signs mail apps out at once; the key keeps working for the API. A key with access on can’t be revoked. An account-wide key, or a pod-scoped key for this inbox’s pod, may update; an inbox-scoped key cannot.
PATCH
https://api.openmail.sh
/
v1
/
inboxes
/
{id}
/
api-keys
/
{keyId}
Update inbox API key
curl --request PATCH \
--url https://api.openmail.sh/v1/inboxes/{id}/api-keys/{keyId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mailAccess": true
}
'import requests
url = "https://api.openmail.sh/v1/inboxes/{id}/api-keys/{keyId}"
payload = { "mailAccess": True }
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({mailAccess: true})
};
fetch('https://api.openmail.sh/v1/inboxes/{id}/api-keys/{keyId}', 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.openmail.sh/v1/inboxes/{id}/api-keys/{keyId}",
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([
'mailAccess' => true
]),
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.openmail.sh/v1/inboxes/{id}/api-keys/{keyId}"
payload := strings.NewReader("{\n \"mailAccess\": true\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.openmail.sh/v1/inboxes/{id}/api-keys/{keyId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"mailAccess\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openmail.sh/v1/inboxes/{id}/api-keys/{keyId}")
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 \"mailAccess\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"podId": "<string>",
"inboxId": "<string>",
"tokenPrefix": "<string>",
"last4": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"lastUsedAt": "2023-11-07T05:31:56Z",
"mailAccess": true
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Authorizations
Body
application/json
Response
Key updated
Key updated
Was this page helpful?