{"openapi":"3.1.0","info":{"title":"Docgen HTTP API","version":"1.0.0","description":"API perusahaan dengan mode test/live terpisah. Semua POST memerlukan Idempotency-Key. Rate limit 100 request/menit/key. Harga/aktivasi ditampilkan di dashboard."},"servers":[{"url":"https://0.0.0.0:3000/api/v1"}],"paths":{"/ping":{"get":{"summary":"Periksa key dan mode","description":"Scope: key aktif.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Berhasil","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"const":true},"mode":{"enum":["test","live"]}}}}}},"default":{"description":"Request ditolak; lihat error.type, message, dan field.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/documents":{"post":{"summary":"Buat dokumen","description":"Scope: documents:write.","security":[{"bearerAuth":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":1},"description":"Gunakan kembali key dan body yang sama saat retry."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDocument"}}}},"responses":{"201":{"description":"Berhasil","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatedDocument"}}}},"default":{"description":"Request ditolak; lihat error.type, message, dan field.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/documents/{id}":{"get":{"summary":"Baca dokumen dan item","description":"Scope: documents:read.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Berhasil","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"description":"Request ditolak; lihat error.type, message, dan field.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}]}},"/documents/{id}.pdf":{"get":{"summary":"Unduh PDF","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"PDF dokumen. Mode test diberi watermark TEST.","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"default":{"description":"Request ditolak; lihat error.type, message, dan field.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects":{"post":{"summary":"Buat proyek dan termin","description":"Scope: projects:write.","security":[{"bearerAuth":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":1},"description":"Gunakan kembali key dan body yang sama saat retry."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProject"}}}},"responses":{"201":{"description":"Berhasil","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"description":"Request ditolak; lihat error.type, message, dan field.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/signatures":{"post":{"summary":"Buat permintaan tanda tangan berurutan","description":"Scope: signatures:write.","security":[{"bearerAuth":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":1},"description":"Gunakan kembali key dan body yang sama saat retry."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSignature"}}}},"responses":{"201":{"description":"Berhasil","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"description":"Request ditolak; lihat error.type, message, dan field.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/payments/qris":{"post":{"summary":"Ajukan QRIS invoice; live memerlukan merchant terverifikasi","description":"Scope: payments:write.","security":[{"bearerAuth":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":1},"description":"Gunakan kembali key dan body yang sama saat retry."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateQris"}}}},"responses":{"201":{"description":"Berhasil","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"description":"Request ditolak; lihat error.type, message, dan field.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/templates":{"get":{"summary":"Preferensi dan gaya template","description":"Scope: templates:read.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Berhasil","content":{"application/json":{"schema":{"type":"object","properties":{"default":{"type":"object"},"styles":{"type":"array","items":{"enum":["modern","klasik","minimal","korporat","bold","elegan"]}}}}}}},"default":{"description":"Request ditolak; lihat error.type, message, dan field.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"Docgen API key"}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"field":{"type":"string"}}}}},"CreatedDocument":{"type":"object","required":["id","number","mode","status","pdf_url"],"properties":{"id":{"type":"string","format":"uuid"},"number":{"type":"string"},"mode":{"enum":["test","live"]},"status":{"const":"draft"},"pdf_url":{"type":"string","format":"uri"}}},"CreateDocument":{"type":"object","additionalProperties":false,"required":["type","items"],"oneOf":[{"required":["customer"],"not":{"required":["customer_id"]}},{"required":["customer_id"],"not":{"required":["customer"]}}],"properties":{"type":{"enum":["invoice","offer","quotation","rab","bast","contract","receipt"]},"customer_id":{"type":"string","format":"uuid"},"customer":{"type":"object","additionalProperties":false,"required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":500},"address":{"type":"string","maxLength":500},"email":{"type":"string","format":"email"},"phone":{"type":"string","pattern":"^\\+[1-9]\\d{7,14}$"},"npwp":{"type":"string","pattern":"^(?:\\d{15}|\\d{16})$"}}},"items":{"type":"array","minItems":1,"maxItems":200,"items":{"type":"object","additionalProperties":false,"required":["name","qty","price"],"properties":{"name":{"type":"string","minLength":1,"maxLength":500},"qty":{"type":"number","exclusiveMinimum":0,"maximum":1000000},"unit":{"type":"string","maxLength":32,"default":"unit"},"price":{"type":"integer","minimum":0,"maximum":10000000000000}}}},"tax":{"type":"object","additionalProperties":false,"required":["ppn"],"properties":{"ppn":{"type":"boolean"}}},"template":{"enum":["modern","klasik","minimal","korporat","bold","elegan"]},"issue_date":{"type":"string","format":"date"},"due_date":{"type":"string","format":"date"},"project_id":{"type":"string","format":"uuid"},"termin_id":{"type":"string","format":"uuid"},"discount":{"type":"integer","minimum":0,"maximum":10000000000000,"default":0},"notes":{"type":"string","maxLength":500}}},"CreateProject":{"type":"object","additionalProperties":false,"required":["name","customer_id","value"],"properties":{"name":{"type":"string","minLength":1,"maxLength":500},"customer_id":{"type":"string","format":"uuid"},"value":{"type":"integer","minimum":1,"maximum":10000000000000},"schedule":{"enum":["full","half","staged"],"default":"full"}}},"CreateSignature":{"type":"object","additionalProperties":false,"required":["document_id","signers"],"properties":{"document_id":{"type":"string","format":"uuid"},"emeterai":{"const":false,"default":false,"description":"e-Meterai diajukan melalui dashboard setelah aktivasi."},"signers":{"type":"array","minItems":1,"maxItems":10,"items":{"type":"object","additionalProperties":false,"required":["name","email"],"properties":{"name":{"type":"string","minLength":1,"maxLength":500},"email":{"type":"string","format":"email"},"phone":{"type":"string","pattern":"^\\+[1-9]\\d{7,14}$"}}}}}},"CreateQris":{"type":"object","additionalProperties":false,"required":["document_id"],"properties":{"document_id":{"type":"string","format":"uuid"},"expires_in":{"type":"integer","minimum":300,"maximum":86400,"default":86400}}}}}}