Create file
curl --request POST \
--url https://api.lojou.app/v1/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Apostila do curso.pdf",
"path": "https://cdn.lojou.app/lojou/stores/files/954/apostila.pdf"
}
'import requests
url = "https://api.lojou.app/v1/files"
payload = {
"name": "Apostila do curso.pdf",
"path": "https://cdn.lojou.app/lojou/stores/files/954/apostila.pdf"
}
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({
name: 'Apostila do curso.pdf',
path: 'https://cdn.lojou.app/lojou/stores/files/954/apostila.pdf'
})
};
fetch('https://api.lojou.app/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://api.lojou.app/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 => json_encode([
'name' => 'Apostila do curso.pdf',
'path' => 'https://cdn.lojou.app/lojou/stores/files/954/apostila.pdf'
]),
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.lojou.app/v1/files"
payload := strings.NewReader("{\n \"name\": \"Apostila do curso.pdf\",\n \"path\": \"https://cdn.lojou.app/lojou/stores/files/954/apostila.pdf\"\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.lojou.app/v1/files")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Apostila do curso.pdf\",\n \"path\": \"https://cdn.lojou.app/lojou/stores/files/954/apostila.pdf\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lojou.app/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"] = 'application/json'
request.body = "{\n \"name\": \"Apostila do curso.pdf\",\n \"path\": \"https://cdn.lojou.app/lojou/stores/files/954/apostila.pdf\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "File created successfully.",
"file": {
"id": 43,
"name": "Bônus - Checklist.pdf",
"path": "https://cdn.lojou.app/lojou/stores/files/954/checklist.pdf",
"size": 0,
"type": "link",
"format": "link",
"is_active": true,
"created_at": "2026-08-31T16:20:00.000000Z",
"updated_at": "2026-08-31T16:20:00.000000Z"
}
}{
"status": "error",
"message": "Unauthorized user."
}{
"status": "error",
"message": "Permission denied for this endpoint.",
"error_code": "insufficient_scope",
"required_scopes": [
"orders.read"
],
"missing_scopes": [
"orders.read"
],
"granted_scopes": [
"products.read",
"products.write"
]
}{
"status": "error",
"message": "Validation failed.",
"errors": {
"amount": [
"The amount field is required."
]
}
}Files
Create file
Creates a file record as a link (type=link, format=link) — Lojou doesn’t accept binary uploads through this endpoint, path must already be a reachable URL.
POST
/
v1
/
files
Create file
curl --request POST \
--url https://api.lojou.app/v1/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Apostila do curso.pdf",
"path": "https://cdn.lojou.app/lojou/stores/files/954/apostila.pdf"
}
'import requests
url = "https://api.lojou.app/v1/files"
payload = {
"name": "Apostila do curso.pdf",
"path": "https://cdn.lojou.app/lojou/stores/files/954/apostila.pdf"
}
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({
name: 'Apostila do curso.pdf',
path: 'https://cdn.lojou.app/lojou/stores/files/954/apostila.pdf'
})
};
fetch('https://api.lojou.app/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://api.lojou.app/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 => json_encode([
'name' => 'Apostila do curso.pdf',
'path' => 'https://cdn.lojou.app/lojou/stores/files/954/apostila.pdf'
]),
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.lojou.app/v1/files"
payload := strings.NewReader("{\n \"name\": \"Apostila do curso.pdf\",\n \"path\": \"https://cdn.lojou.app/lojou/stores/files/954/apostila.pdf\"\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.lojou.app/v1/files")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Apostila do curso.pdf\",\n \"path\": \"https://cdn.lojou.app/lojou/stores/files/954/apostila.pdf\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lojou.app/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"] = 'application/json'
request.body = "{\n \"name\": \"Apostila do curso.pdf\",\n \"path\": \"https://cdn.lojou.app/lojou/stores/files/954/apostila.pdf\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "File created successfully.",
"file": {
"id": 43,
"name": "Bônus - Checklist.pdf",
"path": "https://cdn.lojou.app/lojou/stores/files/954/checklist.pdf",
"size": 0,
"type": "link",
"format": "link",
"is_active": true,
"created_at": "2026-08-31T16:20:00.000000Z",
"updated_at": "2026-08-31T16:20:00.000000Z"
}
}{
"status": "error",
"message": "Unauthorized user."
}{
"status": "error",
"message": "Permission denied for this endpoint.",
"error_code": "insufficient_scope",
"required_scopes": [
"orders.read"
],
"missing_scopes": [
"orders.read"
],
"granted_scopes": [
"products.read",
"products.write"
]
}{
"status": "error",
"message": "Validation failed.",
"errors": {
"amount": [
"The amount field is required."
]
}
}Autorizações
Send an API key or an OAuth access token in the Authorization header
as a Bearer token. See Authentication for details.
Corpo
application/json
Resposta
File created
The response is of type object.
