Files
Create an import upload session
Creates a user-owned24hour staging session for a program in the current organization. Submit1–1000 unique filenames, then PUT each file to its returned signed upload_url with the exact Content-Type header. URLs expire after60minutes; the advertised parallel limit is3. Photos permit JPG/JPEG/PNG/GIF up to10MiB each. Document per-file and all batch limits follow deployed PHP upload/post limits. donors is normalized to donor. This step creates staging records; it does not import records. Requires permission: one of imports_manage.
POST
/
admin
/
import_files
/
{program_id}
/
upload-sessions
Create an import upload session
curl --request POST \
--url https://api.gratona.com/v1/admin/import_files/{program_id}/upload-sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"import_type": "photos",
"type": "entity",
"files": [
{
"name": "recipient-42.jpg",
"size_bytes": 102400,
"mime_type": "image/jpeg",
"relative_path": "photos/recipient-42.jpg"
}
]
}
'import requests
url = "https://api.gratona.com/v1/admin/import_files/{program_id}/upload-sessions"
payload = {
"import_type": "photos",
"type": "entity",
"files": [
{
"name": "recipient-42.jpg",
"size_bytes": 102400,
"mime_type": "image/jpeg",
"relative_path": "photos/recipient-42.jpg"
}
]
}
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({
import_type: 'photos',
type: 'entity',
files: [
{
name: 'recipient-42.jpg',
size_bytes: 102400,
mime_type: 'image/jpeg',
relative_path: 'photos/recipient-42.jpg'
}
]
})
};
fetch('https://api.gratona.com/v1/admin/import_files/{program_id}/upload-sessions', 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.gratona.com/v1/admin/import_files/{program_id}/upload-sessions",
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([
'import_type' => 'photos',
'type' => 'entity',
'files' => [
[
'name' => 'recipient-42.jpg',
'size_bytes' => 102400,
'mime_type' => 'image/jpeg',
'relative_path' => 'photos/recipient-42.jpg'
]
]
]),
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.gratona.com/v1/admin/import_files/{program_id}/upload-sessions"
payload := strings.NewReader("{\n \"import_type\": \"photos\",\n \"type\": \"entity\",\n \"files\": [\n {\n \"name\": \"recipient-42.jpg\",\n \"size_bytes\": 102400,\n \"mime_type\": \"image/jpeg\",\n \"relative_path\": \"photos/recipient-42.jpg\"\n }\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://api.gratona.com/v1/admin/import_files/{program_id}/upload-sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"import_type\": \"photos\",\n \"type\": \"entity\",\n \"files\": [\n {\n \"name\": \"recipient-42.jpg\",\n \"size_bytes\": 102400,\n \"mime_type\": \"image/jpeg\",\n \"relative_path\": \"photos/recipient-42.jpg\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/admin/import_files/{program_id}/upload-sessions")
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 \"import_type\": \"photos\",\n \"type\": \"entity\",\n \"files\": [\n {\n \"name\": \"recipient-42.jpg\",\n \"size_bytes\": 102400,\n \"mime_type\": \"image/jpeg\",\n \"relative_path\": \"photos/recipient-42.jpg\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"upload_session_id": "550e8400-e29b-41d4-a716-446655440000",
"expires_at": "2026-10-21T10:00:00Z",
"max_parallel_uploads": 3,
"files": [
{
"file_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"original_name": "<string>",
"relative_path": "<string>",
"temporary_key": "<string>",
"upload_url": "<string>",
"headers": {
"Content-Type": "image/jpeg"
}
}
]
}{
"message": "Unauthorized",
"status": "error"
}{
"message": "Not Found",
"status": "error"
}{
"errors": {},
"status": "error",
"message": "The given data was invalid."
}Authorizations
bearerAuthapiKeyAuth
Passport bearer token authentication for legacy admin sessions.
Path Parameters
Program id in the current organization.
Body
application/json
Validated request fields for this operation.
⌘I
Create an import upload session
curl --request POST \
--url https://api.gratona.com/v1/admin/import_files/{program_id}/upload-sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"import_type": "photos",
"type": "entity",
"files": [
{
"name": "recipient-42.jpg",
"size_bytes": 102400,
"mime_type": "image/jpeg",
"relative_path": "photos/recipient-42.jpg"
}
]
}
'import requests
url = "https://api.gratona.com/v1/admin/import_files/{program_id}/upload-sessions"
payload = {
"import_type": "photos",
"type": "entity",
"files": [
{
"name": "recipient-42.jpg",
"size_bytes": 102400,
"mime_type": "image/jpeg",
"relative_path": "photos/recipient-42.jpg"
}
]
}
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({
import_type: 'photos',
type: 'entity',
files: [
{
name: 'recipient-42.jpg',
size_bytes: 102400,
mime_type: 'image/jpeg',
relative_path: 'photos/recipient-42.jpg'
}
]
})
};
fetch('https://api.gratona.com/v1/admin/import_files/{program_id}/upload-sessions', 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.gratona.com/v1/admin/import_files/{program_id}/upload-sessions",
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([
'import_type' => 'photos',
'type' => 'entity',
'files' => [
[
'name' => 'recipient-42.jpg',
'size_bytes' => 102400,
'mime_type' => 'image/jpeg',
'relative_path' => 'photos/recipient-42.jpg'
]
]
]),
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.gratona.com/v1/admin/import_files/{program_id}/upload-sessions"
payload := strings.NewReader("{\n \"import_type\": \"photos\",\n \"type\": \"entity\",\n \"files\": [\n {\n \"name\": \"recipient-42.jpg\",\n \"size_bytes\": 102400,\n \"mime_type\": \"image/jpeg\",\n \"relative_path\": \"photos/recipient-42.jpg\"\n }\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://api.gratona.com/v1/admin/import_files/{program_id}/upload-sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"import_type\": \"photos\",\n \"type\": \"entity\",\n \"files\": [\n {\n \"name\": \"recipient-42.jpg\",\n \"size_bytes\": 102400,\n \"mime_type\": \"image/jpeg\",\n \"relative_path\": \"photos/recipient-42.jpg\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/admin/import_files/{program_id}/upload-sessions")
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 \"import_type\": \"photos\",\n \"type\": \"entity\",\n \"files\": [\n {\n \"name\": \"recipient-42.jpg\",\n \"size_bytes\": 102400,\n \"mime_type\": \"image/jpeg\",\n \"relative_path\": \"photos/recipient-42.jpg\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"upload_session_id": "550e8400-e29b-41d4-a716-446655440000",
"expires_at": "2026-10-21T10:00:00Z",
"max_parallel_uploads": 3,
"files": [
{
"file_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"original_name": "<string>",
"relative_path": "<string>",
"temporary_key": "<string>",
"upload_url": "<string>",
"headers": {
"Content-Type": "image/jpeg"
}
}
]
}{
"message": "Unauthorized",
"status": "error"
}{
"message": "Not Found",
"status": "error"
}{
"errors": {},
"status": "error",
"message": "The given data was invalid."
}