Replace a Gmail draft's full content
curl --request PUT \
--url https://api.openworklabs.com/v1/capabilities/google-workspace/gmail-draft/{draftId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"confirm": true,
"message": {
"raw": "<string>",
"threadId": "<string>"
}
}
'import requests
url = "https://api.openworklabs.com/v1/capabilities/google-workspace/gmail-draft/{draftId}"
payload = {
"confirm": True,
"message": {
"raw": "<string>",
"threadId": "<string>"
}
}
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({confirm: true, message: {raw: '<string>', threadId: '<string>'}})
};
fetch('https://api.openworklabs.com/v1/capabilities/google-workspace/gmail-draft/{draftId}', 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.openworklabs.com/v1/capabilities/google-workspace/gmail-draft/{draftId}",
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([
'confirm' => true,
'message' => [
'raw' => '<string>',
'threadId' => '<string>'
]
]),
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.openworklabs.com/v1/capabilities/google-workspace/gmail-draft/{draftId}"
payload := strings.NewReader("{\n \"confirm\": true,\n \"message\": {\n \"raw\": \"<string>\",\n \"threadId\": \"<string>\"\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.openworklabs.com/v1/capabilities/google-workspace/gmail-draft/{draftId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"confirm\": true,\n \"message\": {\n \"raw\": \"<string>\",\n \"threadId\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openworklabs.com/v1/capabilities/google-workspace/gmail-draft/{draftId}")
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 \"confirm\": true,\n \"message\": {\n \"raw\": \"<string>\",\n \"threadId\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"message": {
"id": "<string>",
"threadId": "<string>"
}
}{
"error": "invalid_request",
"details": [
{
"message": "<string>",
"path": [
"<string>"
]
}
],
"capability": "<string>"
}{
"error": "unauthorized"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "invalid_request",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Capability Sources
Replace a Gmail draft's full content
Replaces the draft message, not a partial text edit. Supply the complete base64url RFC 2822 MIME message, preserving intended recipients, reply headers, threadId and attachments. Read the existing draft first; omitted content is lost. Does not send. Requires gmail.compose or gmail.modify. Uses only the calling member’s selected connected Google account. Perform writes only when explicitly requested by the user; capability discovery or selection is not authorization. Never automatically retry an uncertain write.
PUT
/
v1
/
capabilities
/
google-workspace
/
gmail-draft
/
{draftId}
Replace a Gmail draft's full content
curl --request PUT \
--url https://api.openworklabs.com/v1/capabilities/google-workspace/gmail-draft/{draftId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"confirm": true,
"message": {
"raw": "<string>",
"threadId": "<string>"
}
}
'import requests
url = "https://api.openworklabs.com/v1/capabilities/google-workspace/gmail-draft/{draftId}"
payload = {
"confirm": True,
"message": {
"raw": "<string>",
"threadId": "<string>"
}
}
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({confirm: true, message: {raw: '<string>', threadId: '<string>'}})
};
fetch('https://api.openworklabs.com/v1/capabilities/google-workspace/gmail-draft/{draftId}', 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.openworklabs.com/v1/capabilities/google-workspace/gmail-draft/{draftId}",
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([
'confirm' => true,
'message' => [
'raw' => '<string>',
'threadId' => '<string>'
]
]),
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.openworklabs.com/v1/capabilities/google-workspace/gmail-draft/{draftId}"
payload := strings.NewReader("{\n \"confirm\": true,\n \"message\": {\n \"raw\": \"<string>\",\n \"threadId\": \"<string>\"\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.openworklabs.com/v1/capabilities/google-workspace/gmail-draft/{draftId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"confirm\": true,\n \"message\": {\n \"raw\": \"<string>\",\n \"threadId\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openworklabs.com/v1/capabilities/google-workspace/gmail-draft/{draftId}")
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 \"confirm\": true,\n \"message\": {\n \"raw\": \"<string>\",\n \"threadId\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"message": {
"id": "<string>",
"threadId": "<string>"
}
}{
"error": "invalid_request",
"details": [
{
"message": "<string>",
"path": [
"<string>"
]
}
],
"capability": "<string>"
}{
"error": "unauthorized"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "invalid_request",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Authorizations
bearerAuthdenApiKey
Session token passed as Authorization: Bearer <session-token> for user-authenticated Den routes.
Path Parameters
Existing Gmail draft ID, not its message ID.
Required string length:
1 - 512Body
application/json
Was this page helpful?