curl --request POST \
--url https://api.zivio.net/api/v4/projects/{id}/file_upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'zivio-tenant-id: <api-key>' \
--form file='@example-file' \
--form attachment_scope=internal \
--form 'sensitivity_labels=confidential,internal'import requests
url = "https://api.zivio.net/api/v4/projects/{id}/file_upload"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"attachment_scope": "internal",
"sensitivity_labels": "confidential,internal"
}
headers = {
"Authorization": "Bearer <token>",
"zivio-tenant-id": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('attachment_scope', 'internal');
form.append('sensitivity_labels', 'confidential,internal');
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'zivio-tenant-id': '<api-key>'}
};
options.body = form;
fetch('https://api.zivio.net/api/v4/projects/{id}/file_upload', 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.zivio.net/api/v4/projects/{id}/file_upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_scope\"\r\n\r\ninternal\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sensitivity_labels\"\r\n\r\nconfidential,internal\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data",
"zivio-tenant-id: <api-key>"
],
]);
$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.zivio.net/api/v4/projects/{id}/file_upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_scope\"\r\n\r\ninternal\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sensitivity_labels\"\r\n\r\nconfidential,internal\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("zivio-tenant-id", "<api-key>")
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.zivio.net/api/v4/projects/{id}/file_upload")
.header("Authorization", "Bearer <token>")
.header("zivio-tenant-id", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_scope\"\r\n\r\ninternal\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sensitivity_labels\"\r\n\r\nconfidential,internal\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zivio.net/api/v4/projects/{id}/file_upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["zivio-tenant-id"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_scope\"\r\n\r\ninternal\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sensitivity_labels\"\r\n\r\nconfidential,internal\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"message": "File uploaded successfully to Project 123"
}{
"message": "Request failed, attachment_scope is missing or invalid"
}{
"error": "invalid_token",
"error_description": "The access token provided is expired, revoked, malformed, or invalid for other reasons"
}{
"message": "You do not have permission to upload files to this project"
}{
"message": "File upload failed: File is invalid"
}Upload a file attachment to a project
Uploads a file and attaches it to the specified project. The attachment_scope must be either project_posting for public attachments or internal for internal attachments. Optionally tag the attachment with one or more sensitivity labels (comma-separated). Requires the :upload CanCanCan ability on the project.
curl --request POST \
--url https://api.zivio.net/api/v4/projects/{id}/file_upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'zivio-tenant-id: <api-key>' \
--form file='@example-file' \
--form attachment_scope=internal \
--form 'sensitivity_labels=confidential,internal'import requests
url = "https://api.zivio.net/api/v4/projects/{id}/file_upload"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"attachment_scope": "internal",
"sensitivity_labels": "confidential,internal"
}
headers = {
"Authorization": "Bearer <token>",
"zivio-tenant-id": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('attachment_scope', 'internal');
form.append('sensitivity_labels', 'confidential,internal');
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'zivio-tenant-id': '<api-key>'}
};
options.body = form;
fetch('https://api.zivio.net/api/v4/projects/{id}/file_upload', 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.zivio.net/api/v4/projects/{id}/file_upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_scope\"\r\n\r\ninternal\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sensitivity_labels\"\r\n\r\nconfidential,internal\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data",
"zivio-tenant-id: <api-key>"
],
]);
$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.zivio.net/api/v4/projects/{id}/file_upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_scope\"\r\n\r\ninternal\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sensitivity_labels\"\r\n\r\nconfidential,internal\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("zivio-tenant-id", "<api-key>")
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.zivio.net/api/v4/projects/{id}/file_upload")
.header("Authorization", "Bearer <token>")
.header("zivio-tenant-id", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_scope\"\r\n\r\ninternal\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sensitivity_labels\"\r\n\r\nconfidential,internal\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zivio.net/api/v4/projects/{id}/file_upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["zivio-tenant-id"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"attachment_scope\"\r\n\r\ninternal\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sensitivity_labels\"\r\n\r\nconfidential,internal\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"message": "File uploaded successfully to Project 123"
}{
"message": "Request failed, attachment_scope is missing or invalid"
}{
"error": "invalid_token",
"error_description": "The access token provided is expired, revoked, malformed, or invalid for other reasons"
}{
"message": "You do not have permission to upload files to this project"
}{
"message": "File upload failed: File is invalid"
}Authorizations
OAuth 2.0 client credentials. The access token from POST /oauth/token is sent as a bearer token. Request only the scopes you need.
Your Zivio organisation identifier. The regional API endpoints serve every Zivio organisation, so each request must identify yours.
Path Parameters
Project ID
Body
The file to upload.
Scope of the attachment.
internal, project_posting "internal"
Optional comma-separated list of sensitivity label names to apply to the attachment.
"confidential,internal"
Response
File uploaded successfully
The response is of type object.

