curl --request POST \
--url https://app.govly.com/api/tools/v1/file_attachments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"target": {
"id": "<string>"
},
"file": {
"type": "new",
"filename": "<string>",
"contentType": "<string>",
"fileSize": 26214400,
"checksum": "<string>"
}
}
'import requests
url = "https://app.govly.com/api/tools/v1/file_attachments"
payload = {
"target": { "id": "<string>" },
"file": {
"type": "new",
"filename": "<string>",
"contentType": "<string>",
"fileSize": 26214400,
"checksum": "<string>"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
target: {id: '<string>'},
file: {
type: 'new',
filename: '<string>',
contentType: '<string>',
fileSize: 26214400,
checksum: '<string>'
}
})
};
fetch('https://app.govly.com/api/tools/v1/file_attachments', 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://app.govly.com/api/tools/v1/file_attachments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'target' => [
'id' => '<string>'
],
'file' => [
'type' => 'new',
'filename' => '<string>',
'contentType' => '<string>',
'fileSize' => 26214400,
'checksum' => '<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://app.govly.com/api/tools/v1/file_attachments"
payload := strings.NewReader("{\n \"target\": {\n \"id\": \"<string>\"\n },\n \"file\": {\n \"type\": \"new\",\n \"filename\": \"<string>\",\n \"contentType\": \"<string>\",\n \"fileSize\": 26214400,\n \"checksum\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://app.govly.com/api/tools/v1/file_attachments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"target\": {\n \"id\": \"<string>\"\n },\n \"file\": {\n \"type\": \"new\",\n \"filename\": \"<string>\",\n \"contentType\": \"<string>\",\n \"fileSize\": 26214400,\n \"checksum\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.govly.com/api/tools/v1/file_attachments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"target\": {\n \"id\": \"<string>\"\n },\n \"file\": {\n \"type\": \"new\",\n \"filename\": \"<string>\",\n \"contentType\": \"<string>\",\n \"fileSize\": 26214400,\n \"checksum\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"status": "upload_required",
"target": {
"type": "workspace",
"id": "<string>"
},
"uploadId": "<string>",
"uploadUrl": "<string>",
"method": "POST",
"requiredHeaders": {},
"expiresAt": "2023-11-07T05:31:56Z",
"instructions": "<string>"
}
}{
"errors": [
{
"status": "<string>",
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>"
}
}
]
}{
"errors": [
{
"status": "<string>",
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>"
}
}
]
}{
"errors": [
{
"status": "<string>",
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>"
}
}
]
}{
"errors": [
{
"status": "<string>",
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>"
}
}
]
}{
"errors": [
{
"status": "<string>",
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>"
}
}
]
}{
"errors": [
{
"status": "<string>",
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>"
}
}
]
}Attach a new or existing file to a supported destination
Available when the file-attachment rollout is enabled for the caller’s organization. Call with a target and exactly one file source. Existing authorized Govly file references attach immediately. A new file’s metadata returns status upload_required and a 15-minute signed Govly URL. The host POSTs bytes using exactly requiredHeaders, then calls this same operation with the same target and file type upload plus uploadId. The byte request needs no OAuth header or API key. File contents never enter tool arguments. Metadata preparation creates a new pending upload on each call. Upload completion retries return the same fileId while the token is valid; reference retries return the same attachment for the same blob and target. Every retry rechecks permissions. Unattached upload blobs are scheduled for cleanup after 24 hours; attached files are retained. All MIME types are allowed; validation checks declared metadata, not file format or malware.
curl --request POST \
--url https://app.govly.com/api/tools/v1/file_attachments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"target": {
"id": "<string>"
},
"file": {
"type": "new",
"filename": "<string>",
"contentType": "<string>",
"fileSize": 26214400,
"checksum": "<string>"
}
}
'import requests
url = "https://app.govly.com/api/tools/v1/file_attachments"
payload = {
"target": { "id": "<string>" },
"file": {
"type": "new",
"filename": "<string>",
"contentType": "<string>",
"fileSize": 26214400,
"checksum": "<string>"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
target: {id: '<string>'},
file: {
type: 'new',
filename: '<string>',
contentType: '<string>',
fileSize: 26214400,
checksum: '<string>'
}
})
};
fetch('https://app.govly.com/api/tools/v1/file_attachments', 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://app.govly.com/api/tools/v1/file_attachments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'target' => [
'id' => '<string>'
],
'file' => [
'type' => 'new',
'filename' => '<string>',
'contentType' => '<string>',
'fileSize' => 26214400,
'checksum' => '<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://app.govly.com/api/tools/v1/file_attachments"
payload := strings.NewReader("{\n \"target\": {\n \"id\": \"<string>\"\n },\n \"file\": {\n \"type\": \"new\",\n \"filename\": \"<string>\",\n \"contentType\": \"<string>\",\n \"fileSize\": 26214400,\n \"checksum\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://app.govly.com/api/tools/v1/file_attachments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"target\": {\n \"id\": \"<string>\"\n },\n \"file\": {\n \"type\": \"new\",\n \"filename\": \"<string>\",\n \"contentType\": \"<string>\",\n \"fileSize\": 26214400,\n \"checksum\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.govly.com/api/tools/v1/file_attachments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"target\": {\n \"id\": \"<string>\"\n },\n \"file\": {\n \"type\": \"new\",\n \"filename\": \"<string>\",\n \"contentType\": \"<string>\",\n \"fileSize\": 26214400,\n \"checksum\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"status": "upload_required",
"target": {
"type": "workspace",
"id": "<string>"
},
"uploadId": "<string>",
"uploadUrl": "<string>",
"method": "POST",
"requiredHeaders": {},
"expiresAt": "2023-11-07T05:31:56Z",
"instructions": "<string>"
}
}{
"errors": [
{
"status": "<string>",
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>"
}
}
]
}{
"errors": [
{
"status": "<string>",
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>"
}
}
]
}{
"errors": [
{
"status": "<string>",
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>"
}
}
]
}{
"errors": [
{
"status": "<string>",
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>"
}
}
]
}{
"errors": [
{
"status": "<string>",
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>"
}
}
]
}{
"errors": [
{
"status": "<string>",
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>"
}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Response
Pending transfer or completed attachment; inspect data.status before reporting success.
- Option 1
- Option 2
Show child attributes
Show child attributes
Was this page helpful?