Ausgewählte API-Keys bearbeiten
Alle Keys müssen zur angemeldeten Organisation gehören. Jede Änderung wird in derselben Transaktion protokolliert. Ein Management-Key kann keine Management-Keys sperren, freigeben oder löschen, auch nicht den eigenen (403).
POST https://tokenlane.de/api/keys/bulk
Authentifizierung
[ [ { "name": "Authorization", "description": "Management-Key der Organisation: Authorization: Bearer sk-tl-v1-…. Bestehende sk-eu--Keys bleiben gültig. Erforderliche Scopes stehen in x-scopes; Inferenz-Keys berechtigen nicht zu Verwaltungsoperationen.", "type": "http bearer", "location": "", "scopes": [] } ] ]
curl
curl --request POST \
--url 'https://tokenlane.de/api/keys/bulk' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Origin: https://tokenlane.de' \
--header 'Content-Type: application/json' \
--data '{
"ids": [
"key_01k7tm3w8vfz6b2r4m9q5xyz7c"
],
"action": "disable"
}'
node
const response = await fetch("https://tokenlane.de/api/keys/bulk", {
method: "POST",
headers: {
"Authorization": "Bearer " + process.env.TOKENLANE_API_KEY,
"Origin": "https://tokenlane.de",
"Content-Type": "application/json",
},
body: `{
"ids": [
"key_01k7tm3w8vfz6b2r4m9q5xyz7c"
],
"action": "disable"
}`,
});
console.log(await response.text());
python
import os
import urllib.request
body = (r'''{
"ids": [
"key_01k7tm3w8vfz6b2r4m9q5xyz7c"
],
"action": "disable"
}''').encode("utf-8")
request = urllib.request.Request(
"https://tokenlane.de/api/keys/bulk",
method="POST",
headers={
"Authorization": "Bearer " + os.environ["TOKENLANE_API_KEY"],
"Origin": "https://tokenlane.de",
"Content-Type": "application/json",
},
data=body,
)
with urllib.request.urlopen(request) as response:
print(response.read().decode("utf-8"))
vercel
// This operation uses HTTP directly.
const response = await fetch("https://tokenlane.de/api/keys/bulk", {
method: "POST",
headers: {
"Authorization": "Bearer " + process.env.TOKENLANE_API_KEY,
"Origin": "https://tokenlane.de",
"Content-Type": "application/json",
},
body: `{
"ids": [
"key_01k7tm3w8vfz6b2r4m9q5xyz7c"
],
"action": "disable"
}`,
});
console.log(await response.text());
Anfrageinhalt: application/json
{
"ids": [
"key_01k7tm3w8vfz6b2r4m9q5xyz7c"
],
"action": "disable"
}
s18: object
{"additionalProperties":"false"}
- ids (Pflichtfeld): s79
s79: array
{"minItems":"1","maxItems":"200"}
s158: string
Ausgewählte Key-ID
{}
"key_01k7tm3w8vfz6b2r4m9q5xyz7c"
- action (Pflichtfeld): s80
s80: string
"disable", "enable", "delete"
{}
Antwort 200: application/json
Anfrage erfolgreich
{
"updated": 0
}
s19: object
{}
- updated (Pflichtfeld): s55
s55: integer
{}
Antwort 400: application/json
Ungültige Anfrage: Validierungsfehler oder ungültige Eingabe.
{
"status": 400,
"code": "VALIDATION_ERROR",
"message": "Request validation failed"
}
s11: object
{}
- requestId (optional): s56
s56: string
Serverseitige Zuordnungs-ID für einen internen Fehler. Auch in X-Request-Id enthalten.
uuid
{}
- status (Pflichtfeld): s57
s57: number
HTTP-Statuscode
{}
400
- code (Pflichtfeld): s58
s58: string
Fehlercode
{}
"VALIDATION_ERROR"
- message (Pflichtfeld): s59
s59: string
Fehlermeldung
{}
"Request validation failed"
- remedy_hint (optional): s60
s60: string
Sichere, ausführbare Abhilfe aus dem Fehlerkatalog.
{}
- details (optional): s61
s61: array
Detaillierte Validierungsfehler
{}
s154: object
{}
- path (Pflichtfeld): s179
s179: string
Feldpfad
{}
"title"
- message (Pflichtfeld): s180
s180: string
Fehlermeldung zum Feld
{}
"Required"
Antwort 401: application/json
Authentifizierung erforderlich: Zugangsdaten fehlen oder sind ungültig.
{
"status": 400,
"code": "VALIDATION_ERROR",
"message": "Request validation failed"
}
Antwort 403: application/json
Berechtigungsumfang reicht nicht aus: authentifiziert, aber nicht berechtigt.
{
"status": 400,
"code": "VALIDATION_ERROR",
"message": "Request validation failed"
}
Antwort 404: application/json
Ressource nicht gefunden
{
"status": 400,
"code": "VALIDATION_ERROR",
"message": "Request validation failed"
}
Antwort 409: application/json
Konflikt mit dem aktuellen Zustand, beispielsweise ein bereits vorhandener Name.
{
"status": 400,
"code": "VALIDATION_ERROR",
"message": "Request validation failed"
}
Antwort 500: application/json
Interner Serverfehler
{
"status": 400,
"code": "VALIDATION_ERROR",
"message": "Request validation failed"
}