Create a Gmail draft with direct multipart workspace attachments
curl --request POST \
--url http://api.den.local/v1/direct-uploads/google-workspace/gmail-draftsimport requests
url = "http://api.den.local/v1/direct-uploads/google-workspace/gmail-drafts"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('http://api.den.local/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 => "http://api.den.local/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",
]);
$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 := "http://api.den.local/v1/direct-uploads/google-workspace/gmail-drafts"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://api.den.local/v1/direct-uploads/google-workspace/gmail-drafts")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.den.local/v1/direct-uploads/google-workspace/gmail-drafts")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
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 http://api.den.local/v1/direct-uploads/google-workspace/gmail-draftsimport requests
url = "http://api.den.local/v1/direct-uploads/google-workspace/gmail-drafts"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('http://api.den.local/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 => "http://api.den.local/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",
]);
$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 := "http://api.den.local/v1/direct-uploads/google-workspace/gmail-drafts"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://api.den.local/v1/direct-uploads/google-workspace/gmail-drafts")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.den.local/v1/direct-uploads/google-workspace/gmail-drafts")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
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>"
}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 when this draft is a threaded reply.
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?