{"openapi":"3.1.0","info":{"title":"Dampingin Agent API","version":"1.0.0","description":"Hire licensed Indonesian advokat from an AI agent. Prices are in IDR; agent prices are the public price +15% (rounded to Rp 50.000)."},"servers":[{"url":"https://api.dampingin.com"},{"url":"http://api.localhost:3100","description":"Local development"}],"security":[{"bearer":[]}],"paths":{"/v1/services":{"get":{"summary":"List agent-eligible services","x-scope":"katalog:baca","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Service"}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/v1/services/{code}":{"get":{"summary":"Get one service","x-scope":"katalog:baca","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Service"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/v1/orders":{"post":{"summary":"Create an Instant Matter order (paid from deposit)","x-scope":"order:buat","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Replaying the same key returns the original order (200)."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrder"}}}},"responses":{"200":{"description":"Idempotent replay","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"201":{"description":"Created. `status` is `dibayar` (paid from deposit) or `menunggu_bayar` when org approval is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/v1/orders/{id}":{"get":{"summary":"Get order status and result","x-scope":"status:baca","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/v1/orders/{id}/accept":{"post":{"summary":"Accept a delivered order (releases escrow)","x-scope":"order:buat","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/v1/orders/{id}/messages":{"post":{"summary":"Send client input (answers a butuh_input_klien request)","x-scope":"order:buat","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/v1/cases":{"post":{"summary":"Submit a custom case for bids","x-scope":"kasus:buat","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCase"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Case"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/v1/cases/{id}":{"get":{"summary":"Get case status and bids","x-scope":"status:baca","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Case"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/v1/cases/{id}/select":{"post":{"summary":"Select a bid (creates an invoice)","x-scope":"kasus:buat","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["bid_id"],"properties":{"bid_id":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"case":{"$ref":"#/components/schemas/Case"},"invoice":{"type":"object","properties":{"id":{"type":"string"},"total_idr":{"type":"integer"},"status":{"type":"string"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/v1/balance":{"get":{"summary":"Deposit balance and key budgets","x-scope":"status:baca","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Balance"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"402":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}}},"webhooks":{"orderEvent":{"post":{"summary":"Order status changed","description":"Sent to the order callback_url. Header `X-Dampingin-Signature: t=<unix>,v1=<hex HMAC-SHA256(webhook_secret, t + '.' + raw_body)>`. Non-2xx responses are retried with backoff.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Acknowledged"}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"API key `dk_live_xxx.secret`"}},"responses":{"Error":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","examples":["BUDGET_EXCEEDED"]},"message":{"type":"string"}}}}},"IntakeField":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"required":{"type":"boolean"},"type":{"type":"string"}}},"Service":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"category":{"type":"string"},"description":{"type":"string"},"price_idr":{"type":"integer","description":"Agent price (public price +15%)"},"sla":{"type":"object","properties":{"days":{"type":"integer"},"label":{"type":"string"}}},"intake":{"type":"array","items":{"$ref":"#/components/schemas/IntakeField"}},"third_party":{"type":["string","null"],"description":"Third-party costs billed separately at official rates"}}},"CreateOrder":{"type":"object","required":["service","intake"],"properties":{"service":{"type":"string"},"intake":{"type":"object","additionalProperties":{"type":"string"}},"max_budget":{"type":"integer"},"callback_url":{"type":"string","format":"uri"}}},"OrderStatus":{"type":"string","enum":["dibuat","menunggu_bayar","dibayar","ditawarkan","diambil","dikerjakan","butuh_input_klien","diserahkan","selesai","dibatalkan","sengketa","direfund"]},"Order":{"type":"object","properties":{"id":{"type":"string"},"service":{"type":"string"},"status":{"$ref":"#/components/schemas/OrderStatus"},"price_idr":{"type":"integer"},"max_budget":{"type":["integer","null"]},"intake":{"type":"object"},"callback_url":{"type":["string","null"]},"sla_due_at":{"type":["string","null"],"format":"date-time"},"deliverable":{"type":["string","null"]},"approval_required":{"type":"boolean"},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string"},"body":{"type":"string"},"created_at":{"type":"string","format":"date-time"}}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"Message":{"type":"object","required":["body"],"properties":{"body":{"type":"string"}}},"CreateCase":{"type":"object","required":["contact_name","contact_email","story"],"properties":{"contact_name":{"type":"string"},"contact_email":{"type":"string","format":"email"},"contact_phone":{"type":"string"},"story":{"type":"string","minLength":30},"area":{"type":"string"},"urgency":{"type":"string"},"budget_range":{"type":"string"}}},"Bid":{"type":"object","properties":{"id":{"type":"string"},"scope":{"type":"string"},"eta_days":{"type":"integer"},"note":{"type":["string","null"]},"status":{"type":"string"},"price_idr":{"type":"integer"},"client_pays":{"type":"integer"},"created_at":{"type":"string","format":"date-time"}}},"Case":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"area":{"type":["string","null"]},"urgency":{"type":"string"},"budget_range":{"type":"string"},"selected_bid_id":{"type":["string","null"]},"bids":{"type":"array","items":{"$ref":"#/components/schemas/Bid"}},"created_at":{"type":"string","format":"date-time"}}},"Balance":{"type":"object","properties":{"deposit_idr":{"type":"integer"},"key":{"type":"object","properties":{"max_order_budget":{"type":"integer"},"monthly_budget":{"type":"integer"},"spent_this_month":{"type":"integer"},"scopes":{"type":"array","items":{"type":"string"}}}}}},"WebhookEvent":{"type":"object","properties":{"event":{"type":"string","examples":["order.diserahkan"]},"sent_at":{"type":"string","format":"date-time"},"order":{"type":"object","properties":{"id":{"type":"string"},"status":{"$ref":"#/components/schemas/OrderStatus"},"service":{"type":"string"},"price_idr":{"type":"integer"},"sla_due_at":{"type":["string","null"]},"deliverable":{"type":["string","null"]},"updated_at":{"type":"string"}}}}}}}}