API-Authentifizierung
Die ResellerAPI verwendet Bearer-Token-Authentifizierung. Jede Anfrage muss den API-Key im Authorization-Header mitschicken.
Beispiel
<?php
$apiUrl = "https://v2.resellerapi.de/account/balance";
$apiKey = "DEIN_API_KEY";
$options = [
"http" => [
"header" => "Authorization: Bearer " . $apiKey,
"method" => "GET"
]
];
$context = stream_context_create($options);
$response = file_get_contents($apiUrl, false, $context);
$data = json_decode($response, true);
print_r($data);
const axios = require('axios');
const apiUrl = "https://v2.resellerapi.de/account/balance";
const apiKey = "DEIN_API_KEY";
axios.get(apiUrl, {
headers: { "Authorization": `Bearer ${apiKey}` }
})
.then(response => console.log(response.data))
.catch(error => console.error(error.response?.data || error.message));
Fehler bei fehlerhafter Authentifizierung
Wenn der Token fehlt oder ungültig ist, antwortet die API mit Fehlercode 40102:
{
"requestId": 0,
"data": [],
"status": "error",
"messages": {
"errors": [
{
"code": 40102,
"message": "Authentication token is missing or invalid"
}
],
"warnings": [],
"infos": [],
"success": []
}
}
Weitere Fehlercodes findest du unter Fehlercodes.
Rate Limits
Standard: 1.000 Anfragen pro Minute. Bei Überschreitung erhältst du den HTTP-Status 429 Too Many Requests.
Retry-Strategie
Implementiere exponentielles Backoff bei 429-Antworten. Details dazu unter Rate Limiting.