{"openapi":"3.1.0","info":{"title":"CompressGIF API","version":"1.0.0","description":"Asynchronous animated GIF compression. REST and MCP share credits. Valid output consumes credits even when targetMet is false. Failed processing, polling and downloads consume no credits. No automatic overage billing."},"servers":[{"url":"https://compressgif.net"}],"security":[{"bearerKey":[]},{"apiKey":[]}],"x-credit-tiers":[{"maxBytes":5000000,"normalCredits":1},{"maxBytes":20000000,"normalCredits":2}],"x-target-mode-multiplier":2,"paths":{"/api/v1/compressions":{"post":{"operationId":"compressGif","summary":"Create a GIF compression job","description":"Free: up to 5,000,000 bytes, 10 submissions/minute, 2 outstanding jobs. Developer: up to 20,000,000 bytes, 60/minute, 20 outstanding jobs. Each attempt has a total 60-second processing budget.","parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","minLength":1,"maxLength":128},"description":"Account-scoped retry key. Same key with a different request returns 409."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["sourceUrl"],"additionalProperties":false,"properties":{"sourceUrl":{"type":"string","format":"uri","pattern":"^https://"},"options":{"$ref":"#/components/schemas/Options"}}}},"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"},"options":{"type":"string","description":"JSON-encoded Options object.","example":"{\"mode\":\"target\",\"targetBytes\":1000000}"}}}}}},"responses":{"200":{"description":"Idempotent replay; no additional credits reserved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"202":{"description":"Accepted; credits reserved until completion.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"400":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/compressions/{id}":{"get":{"operationId":"getCompression","summary":"Read job status and temporary download link","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Download links last 15 minutes; file access ends after 24 hours.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"400":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/usage":{"get":{"operationId":"getUsage","summary":"Read the shared account credit balance","description":"120 reads/minute across keys. Free resets by UTC calendar month; Developer monthly at the subscription anchor, including annual subscriptions. Unused credits expire.","responses":{"200":{"description":"Allowance, consumed and reserved credits, remaining balance and reset time.","content":{"application/json":{"schema":{"type":"object","required":["usage"],"properties":{"usage":{"$ref":"#/components/schemas/Usage"}}}}}},"400":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Machine-readable error. Respect Retry-After when present.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearerKey":{"type":"http","scheme":"bearer","bearerFormat":"API key"},"apiKey":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"Options":{"type":"object","additionalProperties":false,"properties":{"mode":{"type":"string","enum":["quality","size","target"],"default":"quality"},"targetBytes":{"type":"integer","minimum":1,"description":"Required in target mode; decimal bytes."},"colors":{"enum":["auto",64,128,256]},"lossyLevel":{"type":"integer","minimum":0,"maximum":200},"width":{"type":"integer","minimum":1,"maximum":4096,"description":"Optional explicit resize width; omitted preserves dimensions."}},"allOf":[{"if":{"properties":{"mode":{"const":"target"}},"required":["mode"]},"then":{"required":["targetBytes"]}}]},"Job":{"type":"object","properties":{"id":{"type":"string"},"pool":{"type":"string","enum":["free","developer"]},"status":{"type":"string","enum":["queued","processing","succeeded","failed","canceled"]},"inputBytes":{"type":"integer"},"outputBytes":{"type":["integer","null"]},"credits":{"type":"integer"},"targetMet":{"type":["boolean","null"]},"appliedSettings":{"type":["object","null"]},"result":{"type":["object","null"],"properties":{"downloadUrl":{"type":"string","format":"uri"},"expiresInSeconds":{"type":"integer","minimum":0,"maximum":900}}},"error":{"type":["object","null"],"properties":{"code":{"type":"string"},"message":{"type":"string"}}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"}}},"Usage":{"type":"object","properties":{"pool":{"type":"string","enum":["free","developer"]},"limit":{"type":"integer"},"used":{"type":"integer"},"reserved":{"type":"integer"},"remaining":{"type":"integer"},"resetAt":{"type":"string","format":"date-time"},"windowStart":{"type":"string","format":"date-time"},"windowEnd":{"type":"string","format":"date-time"}}},"Error":{"type":"object","properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}