curl --request POST \
--url https://stashy.example.com/v1/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: */*' \
--data '<string>'import requests
url = "https://stashy.example.com/v1/files"
payload = "<string>"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "*/*"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': '*/*'},
body: '<string>'
};
fetch('https://stashy.example.com/v1/files', 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://stashy.example.com/v1/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "<string>",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: */*"
],
]);
$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://stashy.example.com/v1/files"
payload := strings.NewReader("<string>")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "*/*")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://stashy.example.com/v1/files")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "*/*")
.body("<string>")
.asString();require 'uri'
require 'net/http'
url = URI("https://stashy.example.com/v1/files")
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"] = '*/*'
request.body = "<string>"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"slug": "<string>",
"url": "<string>",
"name": "<string>",
"content_type": "<string>",
"size": "<string>",
"checksum": "<string>",
"visibility": "private",
"created_at": "2023-01-15T01:30:15.01Z",
"updated_at": "2023-01-15T01:30:15.01Z"
}Create File
Upload a new file. The request body is the file’s content, and its Content-Type is stored with it.
curl --request POST \
--url https://stashy.example.com/v1/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: */*' \
--data '<string>'import requests
url = "https://stashy.example.com/v1/files"
payload = "<string>"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "*/*"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': '*/*'},
body: '<string>'
};
fetch('https://stashy.example.com/v1/files', 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://stashy.example.com/v1/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "<string>",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: */*"
],
]);
$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://stashy.example.com/v1/files"
payload := strings.NewReader("<string>")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "*/*")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://stashy.example.com/v1/files")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "*/*")
.body("<string>")
.asString();require 'uri'
require 'net/http'
url = URI("https://stashy.example.com/v1/files")
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"] = '*/*'
request.body = "<string>"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"slug": "<string>",
"url": "<string>",
"name": "<string>",
"content_type": "<string>",
"size": "<string>",
"checksum": "<string>",
"visibility": "private",
"created_at": "2023-01-15T01:30:15.01Z",
"updated_at": "2023-01-15T01:30:15.01Z"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Human-readable end of the file's URL (/{id}/{slug}).
128^[A-Za-z0-9._~-]*$Original filename, e.g. "Quarterly report.pdf".
255Who can open the file by its URL. Defaults to internal.
private, internal, public Body
The body is of type file.
Response
Success
Unique file ID.
^[A-Za-z0-9_-]{21}$Human-readable name at the end of the URL. Empty when not set.
128^[A-Za-z0-9._~-]*$Canonical URL of the file, including the slug when set.
Original filename, e.g. "Quarterly report.pdf". Empty when not set.
255^[^/\x00-\x1F\x7F]*$Media type of the content, from the Content-Type of the upload.
Size of the content in bytes.
CRC32C checksum of the content.
^([A-Za-z0-9+/]{6}==)?$Who can open the file by its URL: "private" (only the owner), "internal" (any signed-in user), or "public" (anyone).
private, internal, public A point in time in RFC 3339 format, with up to nanosecond precision. Output uses UTC (Z); input may use an offset from UTC.
"2023-01-15T01:30:15.01Z"
A point in time in RFC 3339 format, with up to nanosecond precision. Output uses UTC (Z); input may use an offset from UTC.
"2023-01-15T01:30:15.01Z"