Attach file to product
curl --request POST \
--url https://api.lojou.app/v1/products/{id}/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"file_id": 123,
"name": "<string>",
"link": "<string>"
}
'import requests
url = "https://api.lojou.app/v1/products/{id}/files"
payload = {
"file_id": 123,
"name": "<string>",
"link": "<string>"
}
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({file_id: 123, name: '<string>', link: '<string>'})
};
fetch('https://api.lojou.app/v1/products/{id}/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/products/{id}/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([
'file_id' => 123,
'name' => '<string>',
'link' => '<string>'
]),
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/products/{id}/files"
payload := strings.NewReader("{\n \"file_id\": 123,\n \"name\": \"<string>\",\n \"link\": \"<string>\"\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/products/{id}/files")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"file_id\": 123,\n \"name\": \"<string>\",\n \"link\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lojou.app/v1/products/{id}/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 \"file_id\": 123,\n \"name\": \"<string>\",\n \"link\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "File associated with product successfully.",
"file": {
"id": 42,
"store_product_id": 272,
"name": "Bônus - Planilha de controle.xlsx",
"link": "https://cdn.lojou.app/lojou/stores/files/954/planilha.xlsx",
"size": 0,
"format": "link",
"format_type": "MB",
"created_at": "2026-08-31T16:10:00.000000Z"
}
}{
"status": "error",
"message": "Unauthorized user."
}{
"status": "error",
"message": "Product files cannot be modified while product is pending review or approved."
}{
"status": "error",
"message": "Resource not found."
}{
"status": "error",
"message": "This file is already associated with the product."
}{
"status": "error",
"message": "Validation failed.",
"errors": {
"amount": [
"The amount field is required."
]
}
}Products
Attach file to product
Attach an existing store file by file_id, or create a new link on the fly by sending name + link. Blocked while the product is locked for review/approved.
POST
/
v1
/
products
/
{id}
/
files
Attach file to product
curl --request POST \
--url https://api.lojou.app/v1/products/{id}/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"file_id": 123,
"name": "<string>",
"link": "<string>"
}
'import requests
url = "https://api.lojou.app/v1/products/{id}/files"
payload = {
"file_id": 123,
"name": "<string>",
"link": "<string>"
}
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({file_id: 123, name: '<string>', link: '<string>'})
};
fetch('https://api.lojou.app/v1/products/{id}/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/products/{id}/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([
'file_id' => 123,
'name' => '<string>',
'link' => '<string>'
]),
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/products/{id}/files"
payload := strings.NewReader("{\n \"file_id\": 123,\n \"name\": \"<string>\",\n \"link\": \"<string>\"\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/products/{id}/files")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"file_id\": 123,\n \"name\": \"<string>\",\n \"link\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lojou.app/v1/products/{id}/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 \"file_id\": 123,\n \"name\": \"<string>\",\n \"link\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "File associated with product successfully.",
"file": {
"id": 42,
"store_product_id": 272,
"name": "Bônus - Planilha de controle.xlsx",
"link": "https://cdn.lojou.app/lojou/stores/files/954/planilha.xlsx",
"size": 0,
"format": "link",
"format_type": "MB",
"created_at": "2026-08-31T16:10:00.000000Z"
}
}{
"status": "error",
"message": "Unauthorized user."
}{
"status": "error",
"message": "Product files cannot be modified while product is pending review or approved."
}{
"status": "error",
"message": "Resource not found."
}{
"status": "error",
"message": "This file is already associated with the product."
}{
"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.
Parâmetros de caminho
Product identifier (id or product_pid).
Corpo
application/json
Resposta
File attached
The response is of type object.
