Dokumentation
Lerne wie du vorsignierte URLs verwendest
TL;DR
Presign ist ein Open-Source-Dienst, der sichere, zeitlich begrenzte vorsignierte URLs für jede HTTP-API generiert. Damit kannst du API-Zugriff mit Teammitgliedern, Skripten oder Anwendungen teilen, ohne deine API-Schlüssel preiszugeben. Schlüssel werden mit AES-256 verschlüsselt gespeichert, URLs verwenden HMAC-SHA256-Signaturen.
Was ist eine vorsignierte URL?
Eine vorsignierte URL ist ein temporärer, sicherer Link, der Zugriff auf eine API ermöglicht, ohne den zugrunde liegenden API-Schlüssel preiszugeben. Sie beinhaltet integrierte Zugriffskontrollen wie Rate-Limiting, Pfadbeschränkungen und Ablaufdaten.
Verwendung
Create a Connection
Add your API provider and store your API key. You'll receive a Connection ID and a Signing Secret.
Sign URLs in your code
Use HMAC-SHA256 to sign presigned URLs in your own infrastructure. You control expiration, allowed methods, and paths.
Use the presigned URL
Share the URL with clients or use it directly. presign.click verifies the signature and proxies the request to your API.
URL Format
https://presign.click/api/proxy/{connectionId}/{path}?X-Presign-Expires={unix}&X-Presign-Methods={methods}&X-Presign-Paths={paths}&X-Presign-Signature={hmac}connectionId -- Your connection ID (from the Connections page)
path -- API path to proxy (e.g., v1/chat/completions)
X-Presign-Expires -- Unix timestamp (seconds). Use 0 for no expiration.
X-Presign-Methods -- Comma-separated HTTP methods, sorted alphabetically (e.g., GET,POST). Use * for all.
X-Presign-Paths -- Comma-separated path patterns, sorted alphabetically (e.g., v1/chat/*,v1/models). Use * for all.
X-Presign-Signature -- Hex-encoded HMAC-SHA256 signature
Signing Algorithm
Build a canonical string and sign it with HMAC-SHA256 using your connection's signing secret:
Canonical String:
PRESIGN-HMAC-SHA256
{connectionId}
{expiresUnix}
{sortedMethods}
{sortedPaths}
Signature = HMAC-SHA256(signingSecret, canonicalString)
-> hex-encoded Lines are joined by \n. Methods and paths must be sorted alphabetically and comma-separated.
API-Referenz
Response Codes
Code-Beispiele
JavaScript / Node.js
import crypto from 'node:crypto'
const CONNECTION_ID = 'conn_your_id'
const SIGNING_SECRET = 'sk_your_secret'
function createPresignedUrl({ path, methods, paths, expiresIn }) {
const expires = expiresIn
? Math.floor(Date.now() / 1000) + expiresIn
: 0
const sortedMethods = [...methods].sort().join(',')
const sortedPaths = [...paths].sort().join(',')
const canonical = [
'PRESIGN-HMAC-SHA256',
CONNECTION_ID,
expires,
sortedMethods,
sortedPaths,
].join('\n')
const signature = crypto
.createHmac('sha256', SIGNING_SECRET)
.update(canonical)
.digest('hex')
const params = new URLSearchParams({
'X-Presign-Expires': String(expires),
'X-Presign-Methods': sortedMethods,
'X-Presign-Paths': sortedPaths,
'X-Presign-Signature': signature,
})
return `https://presign.click/api/proxy/${CONNECTION_ID}/${path}?${params}`
}
// Create a URL that allows POST to chat completions, expires in 1 hour
const url = createPresignedUrl({
path: 'v1/chat/completions',
methods: ['POST'],
paths: ['v1/chat/*'],
expiresIn: 3600,
})
// Use it
const res = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
model: 'gpt-4',
messages: [{ role: 'user', content: 'Hello' }]
})
})Python
import hmac, hashlib, time, requests
from urllib.parse import urlencode
CONNECTION_ID = 'conn_your_id'
SIGNING_SECRET = 'sk_your_secret'
def create_presigned_url(path, methods, paths, expires_in=None):
expires = int(time.time()) + expires_in if expires_in else 0
sorted_methods = ','.join(sorted(methods))
sorted_paths = ','.join(sorted(paths))
canonical = '\n'.join([
'PRESIGN-HMAC-SHA256',
CONNECTION_ID,
str(expires),
sorted_methods,
sorted_paths,
])
signature = hmac.new(
SIGNING_SECRET.encode(),
canonical.encode(),
hashlib.sha256
).hexdigest()
params = urlencode({
'X-Presign-Expires': expires,
'X-Presign-Methods': sorted_methods,
'X-Presign-Paths': sorted_paths,
'X-Presign-Signature': signature,
})
return f'https://presign.click/api/proxy/{CONNECTION_ID}/{path}?{params}'
# Create a URL that expires in 1 hour
url = create_presigned_url(
path='v1/chat/completions',
methods=['POST'],
paths=['v1/chat/*'],
expires_in=3600,
)
# Use it
response = requests.post(url, json={
'model': 'gpt-4',
'messages': [{'role': 'user', 'content': 'Hello'}]
})cURL (with bash signing)
#!/bin/bash
CONN_ID="conn_your_id"
SECRET="sk_your_secret"
EXPIRES=$(($(date +%s) + 3600)) # 1 hour
METHODS="POST"
PATHS="v1/chat/*"
CANONICAL="PRESIGN-HMAC-SHA256
${CONN_ID}
${EXPIRES}
${METHODS}
${PATHS}"
SIGNATURE=$(echo -n "$CANONICAL" | openssl dgst -sha256 -hmac "$SECRET" -hex | cut -d' ' -f2)
curl "https://presign.click/api/proxy/${CONN_ID}/v1/chat/completions?\
X-Presign-Expires=${EXPIRES}&\
X-Presign-Methods=${METHODS}&\
X-Presign-Paths=${PATHS}&\
X-Presign-Signature=${SIGNATURE}" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-4", "messages": [{"role": "user", "content": "Hello"}]}'Häufig gestellte Fragen
Was ist Presign?
Presign ist ein Open-Source-Dienst, der sichere, zeitlich begrenzte vorsignierte URLs für jede HTTP-API generiert. Damit kannst du API-Zugriff mit Teammitgliedern, Skripten oder Anwendungen teilen, ohne deine API-Schlüssel preiszugeben. Schlüssel werden mit AES-256 verschlüsselt gespeichert, URLs verwenden HMAC-SHA256-Signaturen.
Wie funktioniert Presign?
Du speicherst deinen API-Schlüssel in Presign (mit AES-256 verschlüsselt) und generierst dann eine vorsignierte URL mit bestimmten Berechtigungen: erlaubte HTTP-Methoden, URL-Pfad-Muster und eine Ablaufzeit. Die URL wird mit HMAC-SHA256 und deinem Signing-Secret signiert. Wenn jemand die URL verwendet, prüft Presign die Signatur und leitet die Anfrage an die API weiter.
Ist Presign kostenlos?
Ja. Presign bietet einen kostenlosen Plan mit 3 API-Verbindungen und 1.000 Anfragen pro Monat. Keine Kreditkarte erforderlich. Pro- und Enterprise-Pläne sind für Teams mit höherem Bedarf verfügbar.
Welche APIs werden unterstützt?
Presign funktioniert mit jeder HTTP-API. Der API-Katalog enthält vorkonfigurierte Anbieter wie OpenAI, Anthropic, Groq und mehr. Du kannst auch jede beliebige API hinzufügen, indem du die Basis-URL angibst.
Ist Presign sicher?
Ja. API-Schlüssel werden mit AES-256 verschlüsselt gespeichert und verlassen nie den Server. Vorsignierte URLs verwenden HMAC-SHA256-Signaturen und können nach HTTP-Methode, Pfad-Muster und Ablaufzeit eingeschränkt werden. Der Dienst läuft auf Cloudflare Workers am Edge.
Wie unterscheidet sich Presign von API-Gateways?
Im Gegensatz zu traditionellen API-Gateways konzentriert sich Presign speziell auf die Generierung vorsignierter URLs. URLs sind eigenständig mit Berechtigungen in der Signatur kodiert — kein Session-State, kein Token-Refresh, kein SDK nötig. Empfänger verwenden einfach eine normale URL.