List hosted media
curl --request GET \
--url https://api.nylon.dev/v1/media \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.nylon.dev/v1/media', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.nylon.dev/v1/media"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nylon.dev/v1/media",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.nylon.dev/v1/media")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"url": "<string>",
"type": "image",
"content_type": "image/jpeg",
"size_bytes": 482113,
"status": "temporary",
"expires_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z"
}
],
"meta": {
"pagination": {
"limit": 25,
"offset": 0,
"total": 132,
"has_more": true
}
}
}{
"error": {
"code": "unauthorized",
"message": "A valid Nylon API key is required."
}
}{
"error": {
"code": "rate_limited",
"message": "Too many requests. Retry after the window resets."
}
}{
"error": {
"code": "unauthorized",
"message": "A valid Nylon API key is required.",
"details": [
{
"message": "Instagram requires at least 1 media item — text-only posts are not supported.",
"field": "profile_ids",
"network": "instagram",
"code": "invalid_request"
}
]
}
}Media
List hosted media
Everything Nylon is storing for you, and when it expires.
GET
https://api.nylon.dev
/
v1
/
media
List hosted media
curl --request GET \
--url https://api.nylon.dev/v1/media \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.nylon.dev/v1/media', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.nylon.dev/v1/media"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nylon.dev/v1/media",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.nylon.dev/v1/media")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": [
{
"url": "<string>",
"type": "image",
"content_type": "image/jpeg",
"size_bytes": 482113,
"status": "temporary",
"expires_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z"
}
],
"meta": {
"pagination": {
"limit": 25,
"offset": 0,
"total": 132,
"has_more": true
}
}
}{
"error": {
"code": "unauthorized",
"message": "A valid Nylon API key is required."
}
}{
"error": {
"code": "rate_limited",
"message": "Too many requests. Retry after the window resets."
}
}{
"error": {
"code": "unauthorized",
"message": "A valid Nylon API key is required.",
"details": [
{
"message": "Instagram requires at least 1 media item — text-only posts are not supported.",
"field": "profile_ids",
"network": "instagram",
"code": "invalid_request"
}
]
}
}Authorizations
An API key beginning with nylon_live_.
Query Parameters
Page size, 1–100.
Required range:
1 <= x <= 100Rows to skip.
Required range:
x >= 0Response
The hosted files.
Hide child attributes
Hide child attributes
The handle. Pass this to POST /v1/posts — there is no media id in the API.
Available options:
image, video, gif Example:
"image/jpeg"
Example:
482113
temporary until a post using it publishes; then kept indefinitely.
Available options:
temporary, permanent ⌘I