Create an image upload link
curl --request POST \
--url https://api.gleap.io/v3/uploads/links \
--header 'Authorization: Bearer <token>' \
--header 'project: <project>'import requests
url = "https://api.gleap.io/v3/uploads/links"
headers = {
"project": "<project>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {project: '<project>', Authorization: 'Bearer <token>'}
};
fetch('https://api.gleap.io/v3/uploads/links', 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.gleap.io/v3/uploads/links",
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>",
"project: <project>"
],
]);
$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.gleap.io/v3/uploads/links"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("project", "<project>")
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.gleap.io/v3/uploads/links")
.header("project", "<project>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gleap.io/v3/uploads/links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["project"] = '<project>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"uploadUrl": "<string>",
"expiresAt": "<string>",
"maxBytes": 123,
"allowedTypes": [
"<string>"
]
}Uploads
Create an image upload link
Create a single-use link that accepts one image upload into this project,
for tools that can run curl but hold no Gleap credentials (e.g. an AI agent
connected through the Gleap MCP server). The link expires after 15 minutes
and works once:
curl -sS -F "file=@cover.png" "<uploadUrl>"
Accepts PNG, JPEG, GIF and WebP up to 20 MB (judged by the file’s bytes, not
its name). The response carries the image’s permanent public fileUrl.
POST
/
uploads
/
links
Create an image upload link
curl --request POST \
--url https://api.gleap.io/v3/uploads/links \
--header 'Authorization: Bearer <token>' \
--header 'project: <project>'import requests
url = "https://api.gleap.io/v3/uploads/links"
headers = {
"project": "<project>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {project: '<project>', Authorization: 'Bearer <token>'}
};
fetch('https://api.gleap.io/v3/uploads/links', 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.gleap.io/v3/uploads/links",
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>",
"project: <project>"
],
]);
$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.gleap.io/v3/uploads/links"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("project", "<project>")
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.gleap.io/v3/uploads/links")
.header("project", "<project>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gleap.io/v3/uploads/links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["project"] = '<project>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"uploadUrl": "<string>",
"expiresAt": "<string>",
"maxBytes": 123,
"allowedTypes": [
"<string>"
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.