Téléversement de fichier Base64
curl --request POST \
--url https://files-api.evolink.ai/api/v1/files/upload/base64 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"base64_data": "data:image/png;base64,iVBORw0KGgo..."
}
'import requests
url = "https://files-api.evolink.ai/api/v1/files/upload/base64"
payload = { "base64_data": "data:image/png;base64,iVBORw0KGgo..." }
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({base64_data: 'data:image/png;base64,iVBORw0KGgo...'})
};
fetch('https://files-api.evolink.ai/api/v1/files/upload/base64', 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://files-api.evolink.ai/api/v1/files/upload/base64",
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([
'base64_data' => 'data:image/png;base64,iVBORw0KGgo...'
]),
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://files-api.evolink.ai/api/v1/files/upload/base64"
payload := strings.NewReader("{\n \"base64_data\": \"data:image/png;base64,iVBORw0KGgo...\"\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://files-api.evolink.ai/api/v1/files/upload/base64")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"base64_data\": \"data:image/png;base64,iVBORw0KGgo...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://files-api.evolink.ai/api/v1/files/upload/base64")
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 \"base64_data\": \"data:image/png;base64,iVBORw0KGgo...\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"code": 200,
"msg": "Fichier téléversé avec succès",
"data": {
"file_id": "file_abc123",
"file_name": "avatar.png",
"original_name": "avatar.png",
"file_size": 2048,
"mime_type": "image/png",
"upload_path": "avatars",
"file_url": "https://files.evolink.ai/avatars/avatar.png",
"download_url": "https://files.evolink.ai/api/v1/files/download/file_abc123",
"upload_time": "2025-10-09T00:00:00+08:00",
"expires_at": "2025-10-12T00:00:00+08:00"
}
}File Upload
Téléversement de fichier Base64
- Prend en charge les formats d’encodage Base64 et Data URL
- Identifie automatiquement les types de fichiers et catégorise le stockage
- Retourne des URL de fichiers accessibles et des liens de téléchargement
- Les fichiers expirent après 72 heures
- Le quota utilisateur actuel est limité. Les téléversements échoueront lorsque le quota sera épuisé. Veuillez sauvegarder localement si un stockage persistant est nécessaire
Remarque :
L’URL de base de l’API de téléversement de fichiers est https://files-api.evolink.ai
POST
/
api
/
v1
/
files
/
upload
/
base64
Téléversement de fichier Base64
curl --request POST \
--url https://files-api.evolink.ai/api/v1/files/upload/base64 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"base64_data": "data:image/png;base64,iVBORw0KGgo..."
}
'import requests
url = "https://files-api.evolink.ai/api/v1/files/upload/base64"
payload = { "base64_data": "data:image/png;base64,iVBORw0KGgo..." }
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({base64_data: 'data:image/png;base64,iVBORw0KGgo...'})
};
fetch('https://files-api.evolink.ai/api/v1/files/upload/base64', 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://files-api.evolink.ai/api/v1/files/upload/base64",
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([
'base64_data' => 'data:image/png;base64,iVBORw0KGgo...'
]),
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://files-api.evolink.ai/api/v1/files/upload/base64"
payload := strings.NewReader("{\n \"base64_data\": \"data:image/png;base64,iVBORw0KGgo...\"\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://files-api.evolink.ai/api/v1/files/upload/base64")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"base64_data\": \"data:image/png;base64,iVBORw0KGgo...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://files-api.evolink.ai/api/v1/files/upload/base64")
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 \"base64_data\": \"data:image/png;base64,iVBORw0KGgo...\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"code": 200,
"msg": "Fichier téléversé avec succès",
"data": {
"file_id": "file_abc123",
"file_name": "avatar.png",
"original_name": "avatar.png",
"file_size": 2048,
"mime_type": "image/png",
"upload_path": "avatars",
"file_url": "https://files.evolink.ai/avatars/avatar.png",
"download_url": "https://files.evolink.ai/api/v1/files/download/file_abc123",
"upload_time": "2025-10-09T00:00:00+08:00",
"expires_at": "2025-10-12T00:00:00+08:00"
}
}Autorisations
##Toutes les API nécessitent une authentification Bearer Token##
Obtenir une clé API :
Visitez la Page de gestion des clés API pour obtenir votre clé API
Ajouter à l'en-tête de requête :
Authorization: Bearer YOUR_API_KEY
Corps
application/json
Données de fichier encodées en Base64
Formats pris en charge :
- Format Data URL :
data:image/png;base64,iVBORw0KGgo... - Encodage Base64 pur :
iVBORw0KGgo...
Remarque :
- Maximum
1image par requête - Prend actuellement en charge le téléversement de fichiers aux formats :
image/jpeg,image/png,image/gif,image/webpuniquement
Exemple:
"data:image/png;base64,iVBORw0KGgo..."
Chemin de téléversement personnalisé
Remarque :
- Si non spécifié, le système catégorisera automatiquement en fonction du type de fichier
Exemple:
"avatars"
Nom de fichier personnalisé
Remarque :
- Si non spécifié, le système générera automatiquement un nom de fichier unique
Exemple:
"avatar.png"