{"openapi":"3.1.0","info":{"title":"TIG Agent API","version":"1.1.0","description":"Run Transparent Image Generator (TIG) tools over JSON. Free utilities are instant and keyless; AI tools return a job_id to poll."},"servers":[{"url":"https://gifworkspace.com/functions"}],"components":{"schemas":{"Envelope":{"type":"object","required":["success","data","error","credits","timing_ms"],"properties":{"success":{"type":"boolean"},"data":{"type":["object","null"]},"error":{"type":["object","null"],"properties":{"code":{"type":"string","enum":["INVALID_PARAMS","AUTH_REQUIRED","INSUFFICIENT_CREDITS","TOOL_NOT_FOUND","JOB_NOT_FOUND","TOO_LARGE","UNSUPPORTED_FORMAT","RATE_LIMITED","PROCESSING_FAILED","BROWSER_ONLY"]},"message":{"type":"string"},"docs_url":{"type":"string"}}},"credits":{"type":"object","properties":{"charged":{"type":"number"},"remaining":{"type":["number","null"]}}},"timing_ms":{"type":"number"}}}},"securitySchemes":{"ApiKey":{"type":"apiKey","in":"header","name":"X-Api-Key"},"Session":{"type":"http","scheme":"bearer"}}},"paths":{"/agentApi":{"post":{"operationId":"runTool","summary":"Run a tool","description":"Send the tool slug as ?tool=<slug> or as \"tool\" in the body. Sync tools return output URLs; job tools return 202 with data.job_id.","parameters":[{"name":"tool","in":"query","required":false,"schema":{"type":"string","enum":[]}}],"security":[{},{"ApiKey":[]},{"Session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[],"discriminator":{"propertyName":"tool","mapping":{}}}}}},"responses":{"200":{"description":"Completed (sync tools)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"202":{"description":"Job queued (AI tools) — poll GET /agentApi?job=<id>","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"400":{"description":"INVALID_PARAMS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"401":{"description":"AUTH_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"402":{"description":"INSUFFICIENT_CREDITS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"404":{"description":"TOOL_NOT_FOUND / JOB_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"413":{"description":"TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"415":{"description":"UNSUPPORTED_FORMAT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"429":{"description":"RATE_LIMITED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"500":{"description":"PROCESSING_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"501":{"description":"BROWSER_ONLY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}}}},"get":{"operationId":"getJobOrFile","summary":"Poll a job (?job=<id>) or fetch a discovery file (?file=…)","parameters":[{"name":"job","in":"query","required":false,"schema":{"type":"string"},"description":"Job id → data: { job_id, status, progress_pct, result }"},{"name":"file","in":"query","required":false,"schema":{"type":"string","enum":["llms.txt","llms-full.txt","tools.json","openapi.json"]}}],"security":[{"ApiKey":[]},{"Session":[]},{}],"responses":{"200":{"description":"Job status envelope or discovery file","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"404":{"description":"JOB_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}}}}}}}