RSA sign
Try it interactively →POST /api/rsa-sign2 quota units per call · cache hits free
Sign arbitrary data with an RSA private key. Supports PSS and the legacy PKCS1-v1_5 scheme, SHA-256/384/512. PEM-encoded private key input. Returns signature in hex / base64 / base64url.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| data* | string | — | Message to sign. |
| dataFormat | enum (text | hex | base64) | "text" | Encoding of `data`. |
| privateKeyPem* | string | — | Private key in PKCS#8 PEM format. |
| scheme | enum (pss | pkcs1) | "pss" | Signature scheme: PSS (recommended) or PKCS1-v1_5 (legacy). |
| hash | enum (SHA-256 | SHA-384 | SHA-512) | "SHA-256" | Hash algorithm. |
| saltLength | number (0…256) | 32 | PSS salt length in bytes. Common: equal to hash length. Ignored for PKCS1. |
| outputFormat | enum (hex | base64 | base64url) | "base64" | Encoding of the signature. |
Response
Modes: json. Cache: not cacheable.
Every response carries x-cache (HIT / MISS / BYPASS), x-cache-signature (stable across identical inputs), and the rate-limit headers listed below.
Quota & limits
| Cost per call | 2 units against the 10,000-unit monthly quota. Cache hits are free — only cache misses decrement. |
| Burst limit | 200 requests per rolling minute, shared across all tools. |
| Max request size | 4 MiB (base64 inflates file payloads ~33% — the limit applies to the decoded bytes). |
| Max response size | 16 KiB |
| Timeout | 30s wall clock. |
| Rate-limit headers | X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Burst-Limit on every response; X-Quota-Warning once 80% of the monthly quota is spent; Retry-After on 429s. |
Errors
Errors are JSON with an error string; schema failures add a details object (Zod's flattened field errors).
| Status | When | Body |
|---|---|---|
| 400 | Input fails the tool's schema (wrong type, missing required field, malformed base64) or the file bytes can't be parsed as the expected format. | { "error": "invalid inputs", "details": { "fieldErrors": { … } } } |
| 401 | Missing or invalid X-Api-Key / X-Account-Id headers (or no session when called from the browser). | { "error": "unauthorized" } |
| 404 | Unknown tool id, or calling /api/* on the website hostname instead of api.xtract.bot. | { "error": "not found" } |
| 413 | Request body over the tool's max request size, or an image header declaring more megapixels than the tool's pixel budget. | { "error": "…exceeds maxRequestBytes…" } |
| 415 | Content-Type isn't application/json on the json-body transport. | { "error": "unsupported content-type; expected application/json" } |
| 429 | Monthly quota or the 200/min burst limit exhausted. Check Retry-After and the X-RateLimit-* headers. | { "error": "monthly quota exceeded", "monthRemaining": 0, … } |
| 5xx | Conversion engine failure. Safe to retry; if it persists, the input is hitting a bug — please report it. | { "error": "…" } |
Code samples
Built from the sign-pkcs1 example.
curl -X POST https://api.xtract.bot/api/rsa-sign \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
-H "X-Api-Key: $XTRACT_API_KEY" \
-d '{
"data": "the eagle has landed",
"privateKeyPem": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCO+Tokrkjy6Egb\n/irJHkLzlTm2vebJHKThQvP/zRP+izzKqFb12ijLhDH5uTRTn0aDaAyV4vyqKRJS\nQHwmWRCywAWHX1Y334JZ8K+1dDALT9BgEEp0N8dMt2xf14ngKUlbCfHK+vpvj18h\n/yr1n1Pqj9sqQkZy7aPKBaZWy+QZ/EAC04t+TvgFgCy4Wu3XDKf8Pi407KqvMHAG\nCuozFl6aNIwZNiQYw3h7qagD+XaQrnIy5RnOW+Cjx4ae+r5jAzW8FLL6/5fixfBF\nw8Tsy/RQ6ZVCsd07eIoYtMZSxdLdxt46MBUfJshYK2Qmy++oMcN/VQF7+muKd7Vf\nEs3G8+ZDAgMBAAECggEAFwx0REvjzw5a6vGvacBwUFQQZkvjToJIzaxyqRx2qono\nJnmQmfjDVoUnXgKZPhkxZRIbOUygU+Q5eRC+kvC3zEFALZcqeekVMApToTUrtknL\nJg6/mfsQrObtrd5m8pVlUdZevaIhSREmvSnQKKG4sFnkSJc/mTEt6ZhokkSIr2wp\nDE3/LOHujh2T3y1R5tiSf7BU3+ab9FFZPrQWf7bvlYqWxe8G3GfO5UI3g0zlBorl\n6XDYRQkHZAfd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