Create a Gmail draft with direct multipart workspace attachments
curl --request POST \
--url https://api.openworklabs.com/v1/direct-uploads/google-workspace/gmail-drafts \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.openworklabs.com/v1/direct-uploads/google-workspace/gmail-drafts"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.openworklabs.com/v1/direct-uploads/google-workspace/gmail-drafts', 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/direct-uploads/google-workspace/gmail-drafts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.openworklabs.com/v1/direct-uploads/google-workspace/gmail-drafts"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.openworklabs.com/v1/direct-uploads/google-workspace/gmail-drafts")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openworklabs.com/v1/direct-uploads/google-workspace/gmail-drafts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"ok": true,
"draftId": "<string>",
"messageId": "<string>",
"draftUrl": "<string>",
"threadUrl": "<string>",
"to": "<string>",
"subject": "<string>",
"threadId": "<string>",
"quotedHistoryIncluded": true,
"attachments": [
{
"filename": "<string>",
"mimeType": "<string>",
"size": 4503599627370495
}
]
}{
"error": "invalid_request",
"details": [
{
"message": "<string>",
"path": [
"<string>"
]
}
],
"capability": "<string>"
}{
"error": "unauthorized"
}{
"error": "needs_connection",
"message": "<string>"
}{
"error": "google_api_error",
"message": "<string>"
}Direct uploads
Create a Gmail draft with direct multipart workspace attachments
Authenticated host transport for openwork-cloud-uploads. The route immediately creates the draft and does not persist attachment bytes or expose them to the model.
POST
/
v1
/
direct-uploads
/
google-workspace
/
gmail-drafts
Create a Gmail draft with direct multipart workspace attachments
curl --request POST \
--url https://api.openworklabs.com/v1/direct-uploads/google-workspace/gmail-drafts \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.openworklabs.com/v1/direct-uploads/google-workspace/gmail-drafts"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.openworklabs.com/v1/direct-uploads/google-workspace/gmail-drafts', 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/direct-uploads/google-workspace/gmail-drafts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.openworklabs.com/v1/direct-uploads/google-workspace/gmail-drafts"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.openworklabs.com/v1/direct-uploads/google-workspace/gmail-drafts")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openworklabs.com/v1/direct-uploads/google-workspace/gmail-drafts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"ok": true,
"draftId": "<string>",
"messageId": "<string>",
"draftUrl": "<string>",
"threadUrl": "<string>",
"to": "<string>",
"subject": "<string>",
"threadId": "<string>",
"quotedHistoryIncluded": true,
"attachments": [
{
"filename": "<string>",
"mimeType": "<string>",
"size": 4503599627370495
}
]
}{
"error": "invalid_request",
"details": [
{
"message": "<string>",
"path": [
"<string>"
]
}
],
"capability": "<string>"
}{
"error": "unauthorized"
}{
"error": "needs_connection",
"message": "<string>"
}{
"error": "google_api_error",
"message": "<string>"
}Authorizations
MCP access token issued by the Den OAuth authorization server, passed as Authorization: Bearer <token>. Used by MCP transports and the direct-upload routes they call.
Response
Gmail draft created.
Gmail URL for the ready-to-send draft. Always share draftUrl with the user so they can open the draft in Gmail for review and send.
Gmail URL for the conversation thread returned by Gmail for this draft.
True when quoted conversation history was included by the server or already present in the request body.
Show child attributes
Show child attributes
Was this page helpful?