{"openapi":"3.1.0","info":{"title":"Eonebill API","version":"1.0.0","description":"Organization-scoped API for invoices, customers, documents, payments, and reporting. Money amounts are integer minor units unless an endpoint states otherwise.","contact":{"email":"support@eonebill.ai"}},"servers":[{"url":"https://www.eonebill.ai","description":"Production"}],"tags":[{"name":"Analytics"},{"name":"Auth"},{"name":"Contracts"},{"name":"Credits"},{"name":"Customers"},{"name":"Estimates"},{"name":"Expenses"},{"name":"Invoice Templates"},{"name":"Invoices"},{"name":"Payments"},{"name":"Proposals"},{"name":"Receipts"},{"name":"Signatures"},{"name":"Studio Documents"},{"name":"User"},{"name":"documents"},{"name":"organizations"},{"name":"vendors"}],"paths":{"/api/v1/analytics/overview":{"get":{"operationId":"getAnalyticsOverview","summary":"GET /api/v1/analytics/overview","tags":["Analytics"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"period","in":"query","required":false,"schema":{"type":"string"}},{"name":"date","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/analytics/overview/route.ts"}},"/api/v1/auth/apple":{"post":{"operationId":"postAuthApple","summary":"POST /api/v1/auth/apple","tags":["Auth"],"security":[],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id_token":{},"authorization_code":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"missing fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/auth/apple/route.ts"}},"/api/v1/auth/forgot-password":{"post":{"operationId":"postAuthForgotPassword","summary":"POST /api/v1/auth/forgot-password","tags":["Auth"],"security":[],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"missing fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/auth/forgot-password/route.ts"}},"/api/v1/auth/google":{"post":{"operationId":"postAuthGoogle","summary":"POST /api/v1/auth/google","tags":["Auth"],"security":[],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id_token":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"missing fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/auth/google/route.ts"}},"/api/v1/auth/login":{"post":{"operationId":"postAuthLogin","summary":"POST /api/v1/auth/login","tags":["Auth"],"security":[],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{},"password":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"missing fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/auth/login/route.ts"}},"/api/v1/auth/logout":{"post":{"operationId":"postAuthLogout","summary":"POST /api/v1/auth/logout","tags":["Auth"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/auth/logout/route.ts"}},"/api/v1/auth/me":{"get":{"operationId":"getAuthMe","summary":"GET /api/v1/auth/me","tags":["Auth"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/auth/me/route.ts"}},"/api/v1/auth/register":{"post":{"operationId":"postAuthRegister","summary":"POST /api/v1/auth/register","tags":["Auth"],"security":[],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{},"password":{},"name":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"missing fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/auth/register/route.ts"}},"/api/v1/auth/resend-verification":{"post":{"operationId":"postAuthResendVerification","summary":"POST /api/v1/auth/resend-verification","tags":["Auth"],"security":[],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"missing fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/auth/resend-verification/route.ts"}},"/api/v1/contracts/{id}":{"get":{"operationId":"getContractsById","summary":"GET /api/v1/contracts/{id}","tags":["Contracts"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/contracts/[id]/route.ts"},"put":{"operationId":"putContractsById","summary":"PUT /api/v1/contracts/{id}","tags":["Contracts"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customer_name":{},"customer_email":{},"title":{},"content":{},"value":{},"currency":{},"start_date":{},"end_date":{},"notes":{},"status":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/contracts/[id]/route.ts"},"delete":{"operationId":"deleteContractsById","summary":"─── DELETE /api/v1/contracts/:id ────────────────────────────────────────────","tags":["Contracts"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/contracts/[id]/route.ts"}},"/api/v1/contracts/{id}/send":{"post":{"operationId":"postContractsByIdSend","summary":"POST /api/v1/contracts/{id}/send","tags":["Contracts"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{},"to":{},"cc":{},"subject":{},"message":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"email send failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/contracts/[id]/send/route.ts"}},"/api/v1/contracts/generate-ai":{"post":{"operationId":"postContractsGenerateAi","summary":"POST /api/v1/contracts/generate-ai","tags":["Contracts"],"security":[{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"prompt":{},"currency":{},"customer_id":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"config error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"ai error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/contracts/generate-ai/route.ts"}},"/api/v1/contracts":{"get":{"operationId":"getContracts","summary":"GET /api/v1/contracts","tags":["Contracts"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/contracts/route.ts"},"post":{"operationId":"postContracts","summary":"POST /api/v1/contracts","tags":["Contracts"],"security":[{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customer_id":{},"customer_name":{},"customer_email":{},"title":{},"content":{},"value":{},"currency":{},"start_date":{},"end_date":{},"notes":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/contracts/route.ts"}},"/api/v1/credits/active-features":{"get":{"operationId":"getCreditsActiveFeatures","summary":"GET /api/v1/credits/active-features","tags":["Credits"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/credits/active-features/route.ts"}},"/api/v1/credits/balance":{"get":{"operationId":"getCreditsBalance","summary":"GET /api/v1/credits/balance","tags":["Credits"],"security":[{"ApiKeyAuth":[]},{"OAuth2Auth":[]},{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"monthly API limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds until the monthly allowance resets.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"rate limit unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/credits/balance/route.ts"}},"/api/v1/credits/earn":{"post":{"operationId":"postCreditsEarn","summary":"POST /api/v1/credits/earn","tags":["Credits"],"security":[{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"action":{},"metadata":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/credits/earn/route.ts"}},"/api/v1/credits/history":{"get":{"operationId":"getCreditsHistory","summary":"GET /api/v1/credits/history","tags":["Credits"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"type","in":"query","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/credits/history/route.ts"}},"/api/v1/credits/redeem":{"post":{"operationId":"postCreditsRedeem","summary":"POST /api/v1/credits/redeem","tags":["Credits"],"security":[{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"item":{},"quantity":{},"metadata":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"insufficient credits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/credits/redeem/route.ts"}},"/api/v1/credits/tasks":{"get":{"operationId":"getCreditsTasks","summary":"GET /api/v1/credits/tasks","tags":["Credits"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/credits/tasks/route.ts"}},"/api/v1/customers/{id}":{"get":{"operationId":"getCustomersById","summary":"GET /api/v1/customers/{id}","tags":["Customers"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/customers/[id]/route.ts"},"put":{"operationId":"putCustomersById","summary":"PUT /api/v1/customers/{id}","tags":["Customers"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{},"last_name":{},"company_name":{},"email":{},"phone":{},"address":{},"city":{},"state":{},"zip":{},"country":{},"notes":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/customers/[id]/route.ts"},"delete":{"operationId":"deleteCustomersById","summary":"DELETE /api/v1/customers/{id}","tags":["Customers"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/customers/[id]/route.ts"}},"/api/v1/customers":{"get":{"operationId":"getCustomers","summary":"GET /api/v1/customers","tags":["Customers"],"security":[{"ApiKeyAuth":[]},{"OAuth2Auth":[]},{"BearerAuth":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"monthly API limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds until the monthly allowance resets.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"rate limit unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/customers/route.ts"},"post":{"operationId":"postCustomers","summary":"POST /api/v1/customers","tags":["Customers"],"security":[{"ApiKeyAuth":[]},{"OAuth2Auth":[]},{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{},"last_name":{},"company_name":{},"email":{},"phone":{},"address":{},"city":{},"state":{},"zip":{},"country":{},"notes":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"monthly API limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds until the monthly allowance resets.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"rate limit unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/customers/route.ts"}},"/api/v1/documents/recent":{"get":{"operationId":"getDocumentsRecent","summary":"GET /api/v1/documents/recent","tags":["documents"],"security":[{"ApiKeyAuth":[]},{"OAuth2Auth":[]},{"BearerAuth":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"types","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"monthly API limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds until the monthly allowance resets.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"rate limit unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/documents/recent/route.ts"}},"/api/v1/estimates/{id}/convert-to-invoice":{"post":{"operationId":"postEstimatesByIdConvertToInvoice","summary":"POST /api/v1/estimates/{id}/convert-to-invoice","tags":["Estimates"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"keep_estimate":{},"due_days":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/estimates/[id]/convert-to-invoice/route.ts"}},"/api/v1/estimates/{id}":{"get":{"operationId":"getEstimatesById","summary":"GET /api/v1/estimates/{id}","tags":["Estimates"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/estimates/[id]/route.ts"},"put":{"operationId":"putEstimatesById","summary":"PUT /api/v1/estimates/{id}","tags":["Estimates"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customer_name":{},"customer_email":{},"currency":{},"issue_date":{},"valid_until":{},"line_items":{},"tax_rate":{},"discount":{},"discount_type":{},"notes":{},"payment_terms":{},"status":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/estimates/[id]/route.ts"},"delete":{"operationId":"deleteEstimatesById","summary":"DELETE /api/v1/estimates/{id}","tags":["Estimates"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/estimates/[id]/route.ts"}},"/api/v1/estimates/{id}/send":{"post":{"operationId":"postEstimatesByIdSend","summary":"POST /api/v1/estimates/{id}/send","tags":["Estimates"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"to":{},"cc":{},"subject":{},"message":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"email send failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/estimates/[id]/send/route.ts"}},"/api/v1/estimates/ai-generate":{"post":{"operationId":"postEstimatesAiGenerate","summary":"POST /api/v1/estimates/ai-generate","tags":["Estimates"],"security":[{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"prompt":{},"currency":{},"customer_id":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"ai error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/estimates/ai-generate/route.ts"}},"/api/v1/estimates":{"get":{"operationId":"getEstimates","summary":"GET /api/v1/estimates","tags":["Estimates"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/estimates/route.ts"},"post":{"operationId":"postEstimates","summary":"POST /api/v1/estimates","tags":["Estimates"],"security":[{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customer_id":{},"customer_name":{},"customer_email":{},"currency":{},"issue_date":{},"valid_until":{},"line_items":{},"tax_rate":{},"discount":{},"discount_type":{},"notes":{},"payment_terms":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/estimates/route.ts"}},"/api/v1/expenses/{id}":{"get":{"operationId":"getExpensesById","summary":"GET /api/v1/expenses/{id}","tags":["Expenses"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/expenses/[id]/route.ts"},"put":{"operationId":"putExpensesById","summary":"PUT /api/v1/expenses/{id}","tags":["Expenses"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"vendor":{},"date":{},"total":{},"currency":{},"category":{},"tax":{},"notes":{},"description":{},"is_tax_deductible":{},"image_urls":{},"status":{},"items":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"closed fiscal period","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/expenses/[id]/route.ts"},"delete":{"operationId":"deleteExpensesById","summary":"DELETE /api/v1/expenses/{id}","tags":["Expenses"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"closed fiscal period","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/expenses/[id]/route.ts"}},"/api/v1/expenses/categories":{"get":{"operationId":"getExpensesCategories","summary":"GET /api/v1/expenses/categories","tags":["Expenses"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/expenses/categories/route.ts"}},"/api/v1/expenses/recent":{"get":{"operationId":"getExpensesRecent","summary":"GET /api/v1/expenses/recent","tags":["Expenses"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/expenses/recent/route.ts"}},"/api/v1/expenses":{"get":{"operationId":"getExpenses","summary":"GET /api/v1/expenses","tags":["Expenses"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"}},{"name":"category","in":"query","required":false,"schema":{"type":"string"}},{"name":"date_from","in":"query","required":false,"schema":{"type":"string"}},{"name":"date_to","in":"query","required":false,"schema":{"type":"string"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/expenses/route.ts"},"post":{"operationId":"postExpenses","summary":"POST /api/v1/expenses","tags":["Expenses"],"security":[{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"vendor":{},"date":{},"total":{},"currency":{},"category":{},"tax":{},"notes":{},"description":{},"is_tax_deductible":{},"image_urls":{},"items":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"closed fiscal period","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/expenses/route.ts"}},"/api/v1/expenses/scan":{"post":{"operationId":"postExpensesScan","summary":"POST /api/v1/expenses/scan","tags":["Expenses"],"security":[{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"image":{"type":"string"}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"insufficient credits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"pdf too long","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"vision api failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/expenses/scan/route.ts"}},"/api/v1/invoice-templates":{"get":{"operationId":"getInvoiceTemplates","summary":"GET /api/v1/invoice-templates","tags":["Invoice Templates"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/invoice-templates/route.ts"}},"/api/v1/invoices/{id}/duplicate":{"post":{"operationId":"postInvoicesByIdDuplicate","summary":"POST /api/v1/invoices/{id}/duplicate","tags":["Invoices"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/invoices/[id]/duplicate/route.ts"}},"/api/v1/invoices/{id}/mark-paid":{"post":{"operationId":"postInvoicesByIdMarkPaid","summary":"POST /api/v1/invoices/{id}/mark-paid","tags":["Invoices"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"paid_at":{},"payment_method":{},"payment_reference":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"closed fiscal period","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/invoices/[id]/mark-paid/route.ts"}},"/api/v1/invoices/{id}/payment-link":{"post":{"operationId":"postInvoicesByIdPaymentLink","summary":"POST /api/v1/invoices/{id}/payment-link","tags":["Invoices"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"online payment disabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"stripe not connected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"invoice already paid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/invoices/[id]/payment-link/route.ts"}},"/api/v1/invoices/{id}/pdf":{"get":{"operationId":"getInvoicesByIdPdf","summary":"GET /api/v1/invoices/{id}/pdf","tags":["Invoices"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/invoices/[id]/pdf/route.ts"}},"/api/v1/invoices/{id}/remind":{"post":{"operationId":"postInvoicesByIdRemind","summary":"POST /api/v1/invoices/{id}/remind","tags":["Invoices"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"to":{},"message":{},"tone":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"email send failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/invoices/[id]/remind/route.ts"}},"/api/v1/invoices/{id}":{"get":{"operationId":"getInvoicesById","summary":"GET /api/v1/invoices/{id}","tags":["Invoices"],"security":[{"ApiKeyAuth":[]},{"OAuth2Auth":[]},{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"monthly API limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds until the monthly allowance resets.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"rate limit unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/invoices/[id]/route.ts"},"put":{"operationId":"putInvoicesById","summary":"PUT /api/v1/invoices/{id}","tags":["Invoices"],"security":[{"ApiKeyAuth":[]},{"OAuth2Auth":[]},{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customer_id":{},"issue_date":{},"due_date":{},"line_items":{},"tax_rate":{},"discount":{},"discount_type":{},"notes":{},"payment_terms":{},"payment_methods":{},"payment_instructions":{},"currency":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"payment method required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"monthly API limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds until the monthly allowance resets.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"rate limit unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/invoices/[id]/route.ts"},"delete":{"operationId":"deleteInvoicesById","summary":"DELETE /api/v1/invoices/{id}","tags":["Invoices"],"security":[{"ApiKeyAuth":[]},{"OAuth2Auth":[]},{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"monthly API limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds until the monthly allowance resets.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"rate limit unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/invoices/[id]/route.ts"}},"/api/v1/invoices/{id}/send":{"post":{"operationId":"postInvoicesByIdSend","summary":"POST /api/v1/invoices/{id}/send","tags":["Invoices"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"to":{},"cc":{},"subject":{},"message":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"email send disabled for payment method","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/invoices/[id]/send/route.ts"}},"/api/v1/invoices/ai-generate":{"post":{"operationId":"postInvoicesAiGenerate","summary":"POST /api/v1/invoices/ai-generate","tags":["Invoices"],"security":[{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"text":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"ai error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/invoices/ai-generate/route.ts"}},"/api/v1/invoices":{"get":{"operationId":"getInvoices","summary":"GET /api/v1/invoices","tags":["Invoices"],"security":[{"ApiKeyAuth":[]},{"OAuth2Auth":[]},{"BearerAuth":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"}},{"name":"unpaid_only","in":"query","required":false,"schema":{"type":"string"}},{"name":"customer_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"date_from","in":"query","required":false,"schema":{"type":"string"}},{"name":"date_to","in":"query","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"monthly API limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds until the monthly allowance resets.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"rate limit unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/invoices/route.ts"},"post":{"operationId":"postInvoices","summary":"POST /api/v1/invoices","tags":["Invoices"],"security":[{"ApiKeyAuth":[]},{"OAuth2Auth":[]},{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customer_id":{},"issue_date":{},"due_date":{},"line_items":{},"tax_rate":{},"discount":{},"discount_type":{},"notes":{},"payment_terms":{},"payment_methods":{},"payment_instructions":{},"template_id":{},"currency":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"payment method required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"monthly API limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds until the monthly allowance resets.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"rate limit unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/invoices/route.ts"}},"/api/v1/organizations":{"get":{"operationId":"getOrganizations","summary":"─── GET /api/v1/organizations ────────────────────────────────────────────── Returns every organization the signed-in user is a member of, plus a flag marking which one is currently active in this session. Drives the App's org-switcher dropdown — user picks one, App calls POST /switch with the id.  Sorted by membership createdAt desc (newest joined first), matching the web dashboard's switcher order in getTeamSnapshot().","tags":["organizations"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/organizations/route.ts"}},"/api/v1/organizations/switch":{"post":{"operationId":"postOrganizationsSwitch","summary":"─── POST /api/v1/organizations/switch ────────────────────────────────────── Body: { organization_id: string }  Switches the signed-in user's active organization for this session. Subsequent v1 calls that resolve org context (anything using getOrgContextFromRequest) will route to the newly chosen organization. Membership is verified before the switch so a stale id can't grant access to an org the user no longer belongs to.","tags":["organizations"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"missing field","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/organizations/switch/route.ts"}},"/api/v1/payments/overview":{"get":{"operationId":"getPaymentsOverview","summary":"GET /api/v1/payments/overview","tags":["Payments"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/payments/overview/route.ts"}},"/api/v1/payments/stripe/account":{"get":{"operationId":"getPaymentsStripeAccount","summary":"GET /api/v1/payments/stripe/account","tags":["Payments"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"config error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/payments/stripe/account/route.ts"}},"/api/v1/payments/stripe/connect":{"post":{"operationId":"postPaymentsStripeConnect","summary":"POST /api/v1/payments/stripe/connect","tags":["Payments"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"config error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/payments/stripe/connect/route.ts"}},"/api/v1/payments/stripe/disconnect":{"post":{"operationId":"postPaymentsStripeDisconnect","summary":"─── POST /api/v1/payments/stripe/disconnect ───────────────────────────────── Soft-disconnects: clears user.stripeConnectId and marks all stripe rows in payment_account as inactive. Does NOT delete the account on Stripe — per Stripe best practices, accounts remain on the platform for audit/payout. User can reconnect later (a new Express account will be created).","tags":["Payments"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/payments/stripe/disconnect/route.ts"}},"/api/v1/proposals/{id}/convert-to-contract":{"post":{"operationId":"postProposalsByIdConvertToContract","summary":"POST /api/v1/proposals/{id}/convert-to-contract","tags":["Proposals"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"start_date":{},"end_date":{},"keep_proposal":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/proposals/[id]/convert-to-contract/route.ts"}},"/api/v1/proposals/{id}":{"get":{"operationId":"getProposalsById","summary":"GET /api/v1/proposals/{id}","tags":["Proposals"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/proposals/[id]/route.ts"},"put":{"operationId":"putProposalsById","summary":"PUT /api/v1/proposals/{id}","tags":["Proposals"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customer_name":{},"customer_email":{},"title":{},"content":{},"value":{},"currency":{},"valid_until":{},"notes":{},"status":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/proposals/[id]/route.ts"},"delete":{"operationId":"deleteProposalsById","summary":"─── DELETE /api/v1/proposals/:id ────────────────────────────────────────────","tags":["Proposals"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/proposals/[id]/route.ts"}},"/api/v1/proposals/{id}/send":{"post":{"operationId":"postProposalsByIdSend","summary":"POST /api/v1/proposals/{id}/send","tags":["Proposals"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{},"to":{},"cc":{},"subject":{},"message":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"email send failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/proposals/[id]/send/route.ts"}},"/api/v1/proposals/generate-ai":{"post":{"operationId":"postProposalsGenerateAi","summary":"POST /api/v1/proposals/generate-ai","tags":["Proposals"],"security":[{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"prompt":{},"currency":{},"customer_id":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"config error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"ai error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/proposals/generate-ai/route.ts"}},"/api/v1/proposals":{"get":{"operationId":"getProposals","summary":"GET /api/v1/proposals","tags":["Proposals"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/proposals/route.ts"},"post":{"operationId":"postProposals","summary":"POST /api/v1/proposals","tags":["Proposals"],"security":[{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customer_id":{},"customer_name":{},"customer_email":{},"title":{},"content":{},"value":{},"currency":{},"valid_until":{},"notes":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/proposals/route.ts"}},"/api/v1/receipts/{id}":{"get":{"operationId":"getReceiptsById","summary":"GET /api/v1/receipts/{id}","tags":["Receipts"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/receipts/[id]/route.ts"},"put":{"operationId":"putReceiptsById","summary":"PUT /api/v1/receipts/{id}","tags":["Receipts"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/receipts/[id]/route.ts"},"delete":{"operationId":"deleteReceiptsById","summary":"DELETE /api/v1/receipts/{id}","tags":["Receipts"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/receipts/[id]/route.ts"}},"/api/v1/receipts/{id}/send":{"post":{"operationId":"postReceiptsByIdSend","summary":"POST /api/v1/receipts/{id}/send","tags":["Receipts"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"to":{},"cc":{},"subject":{},"message":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"email send failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/receipts/[id]/send/route.ts"}},"/api/v1/receipts/from-invoice/{invoice_id}":{"post":{"operationId":"postReceiptsFromInvoiceByInvoiceid","summary":"POST /api/v1/receipts/from-invoice/{invoice_id}","tags":["Receipts"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"payment_method":{},"payment_date":{},"notes":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/receipts/from-invoice/[invoice_id]/route.ts"}},"/api/v1/receipts":{"post":{"operationId":"postReceipts","summary":"POST /api/v1/receipts","tags":["Receipts"],"security":[{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customer_id":{},"customer_name":{},"customer_email":{},"description":{},"amount":{},"currency":{},"payment_method":{},"payment_date":{},"notes":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/receipts/route.ts"},"get":{"operationId":"getReceipts","summary":"GET /api/v1/receipts","tags":["Receipts"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/receipts/route.ts"}},"/api/v1/signatures/{requestId}/audit":{"get":{"operationId":"getSignaturesByRequestIdAudit","summary":"GET /api/v1/signatures/[requestId]/audit   Auth required. Only the request creator can view the audit trail.   The URL slot accepts the request UUID (not a token).","tags":["Signatures"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"requestId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/signatures/[requestId]/audit/route.ts"}},"/api/v1/signatures/{requestId}/cancel":{"post":{"operationId":"postSignaturesByRequestIdCancel","summary":"POST /api/v1/signatures/[requestId]/cancel   Auth required. Sender cancels a not-yet-signed request, refunding the   monthly quota slot (cancelled rows are excluded from the count).","tags":["Signatures"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"requestId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"invalid state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/signatures/[requestId]/cancel/route.ts"}},"/api/v1/signatures/{requestId}/consent":{"post":{"operationId":"postSignaturesByRequestIdConsent","summary":"POST /api/v1/signatures/[requestId]/consent   Public token-based access. Records the recipient's ESIGN consent   (or decline) and advances OPENED → CONSENTED.","tags":["Signatures"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"requestId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"invalid state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"token expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/signatures/[requestId]/consent/route.ts"}},"/api/v1/signatures/{requestId}/download":{"get":{"operationId":"getSignaturesByRequestIdDownload","summary":"GET /api/v1/signatures/[requestId]/download   Returns the signed PDF as application/pdf. Two access modes:     (a) Auth'd request creator — by UUID, requires session     (b) Recipient — by 64-hex-char token, status must be 'signed'","tags":["Signatures"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"requestId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"not signed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/signatures/[requestId]/download/route.ts"}},"/api/v1/signatures/{requestId}/resend":{"post":{"operationId":"postSignaturesByRequestIdResend","summary":"POST /api/v1/signatures/[requestId]/resend   Auth required. Sender re-sends the original invitation email. Reminder   number is computed from prior reminder_sent audit events.","tags":["Signatures"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"requestId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"invalid state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"token expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"email failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/signatures/[requestId]/resend/route.ts"}},"/api/v1/signatures/{requestId}":{"get":{"operationId":"getSignaturesByRequestId","summary":"GET /api/v1/signatures/[requestId]   Polymorphic load:     (a) 64-hex-char token  → public recipient view (advances PENDING→OPENED)     (b) UUID + valid session  → sender's own request (no status advance)   Anything else → 404.","tags":["Signatures"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"requestId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"already signed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/signatures/[requestId]/route.ts"}},"/api/v1/signatures/{requestId}/sign":{"post":{"operationId":"postSignaturesByRequestIdSign","summary":"POST /api/v1/signatures/[requestId]/sign   Public token-based access. Embeds the signature into the PDF, encrypts it,   stores it on S3, marks the request signed, and notifies both parties.","tags":["Signatures"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"requestId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"invalid state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"already signed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/signatures/[requestId]/sign/route.ts"}},"/api/v1/signatures":{"post":{"operationId":"postSignatures","summary":"─── POST /api/v1/signatures — create new request ────────────────────────────","tags":["Signatures"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/signatures/route.ts"},"get":{"operationId":"getSignatures","summary":"─── GET /api/v1/signatures — list user's requests ───────────────────────────","tags":["Signatures"],"security":[{"ApiKeyAuth":[]},{"OAuth2Auth":[]},{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"monthly API limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds until the monthly allowance resets.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"rate limit unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/signatures/route.ts"}},"/api/v1/signatures/upload-pdf":{"post":{"operationId":"postSignaturesUploadPdf","summary":"POST /api/v1/signatures/upload-pdf   Multipart upload of a PDF that the sender wants to e-sign. Validates   format + non-encryption + size, then stores under   `signatures/originals/<uuid>.pdf` in the project's storage bucket.   Returns `{ pdfUrl, key, sizeBytes }` for use in the subsequent   `POST /api/v1/signatures` call.","tags":["Signatures"],"security":[{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string"}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"empty file","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/signatures/upload-pdf/route.ts"}},"/api/v1/studio-documents/{id}/preview":{"get":{"operationId":"getStudioDocumentsByIdPreview","summary":"Generic preview-data endpoint for any studio_document row (proposal, contract, estimate, receipt, etc.). Returns the resolved TemplateDefinition + raw documentData so the client can call renderStudioTemplateHtml(...) and display the same HTML the user sees when exporting from the marketing studio.","tags":["Studio Documents"],"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/studio-documents/[id]/preview/route.ts"}},"/api/v1/user/account":{"delete":{"operationId":"deleteUserAccount","summary":"─── DELETE /api/v1/user/account ──────────────────────────────────────────── Apple App Store 5.1.1(v) requires every app that supports account creation to also provide in-app account deletion. The web settings page has authClient.deleteUser() but mobile clients can't reach that cookie-driven flow on a Bearer-only session, so this v1 endpoint is the equivalent.  What gets deleted (Better Auth + DB cascade do the heavy lifting):   - user row, session, account                       (Better Auth internal)   - payment, userCredit, creditTransaction,     userFeatureUnlock, expense*, paymentAccount,     studioDocument, signatureRequest*                 (schema-level cascade)  What stays — intentional, business data belongs to the organization not the individual; a re-registered user gets a brand-new user.id and never reaches these rows again:   - invoice / customer / contract / proposal / tag   - organizationMember rows for this user   - organization rows (their personal org becomes orphaned)   - S3 files (avatar, company logo)  External cleanup we do explicitly:   - Stripe customer deletion via customers.del(customerId), which     cancels every subscription and stops future charges. Apple     specifically calls out \"deleted account keeps getting billed\" as     a top rejection reason for this guideline.  Body: { \"confirmation\": \"DELETE\" } — guard against accidental DELETE.","tags":["User"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"confirmation mismatch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/user/account/route.ts"}},"/api/v1/user/avatar":{"post":{"operationId":"postUserAvatar","summary":"POST /api/v1/user/avatar","tags":["User"],"security":[{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"avatar":{"type":"string"}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"invalid format","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"413":{"description":"file too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/user/avatar/route.ts"}},"/api/v1/user/company/logo":{"post":{"operationId":"postUserCompanyLogo","summary":"POST /api/v1/user/company/logo","tags":["User"],"security":[{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"logo":{"type":"string"}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"file too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/user/company/logo/route.ts"}},"/api/v1/user/company":{"get":{"operationId":"getUserCompany","summary":"─── GET /api/v1/user/company ─────────────────────────────────────────────── Read the same shape that PUT writes — used by the App settings form to pre-fill values without round-tripping through /auth/me (which doesn't flatten the JSON-packed address sub-fields).","tags":["User"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/user/company/route.ts"},"put":{"operationId":"putUserCompany","summary":"PUT /api/v1/user/company","tags":["User"],"security":[{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"company_name":{},"company_email":{},"company_phone":{},"company_website":{},"company_address":{},"company_city":{},"company_state":{},"company_zip":{},"company_country":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/user/company/route.ts"}},"/api/v1/user/organizations":{"get":{"operationId":"getUserOrganizations","summary":"─── GET /api/v1/user/organizations ───────────────────────────────────────── Returns every organization the signed-in user is a member of, plus the id of the currently active organization (used to render the \"My Business\" dropdown on the App home screen). Active org id is read from the session row directly (not from the better-auth session cookie cache) so it reflects the very latest switch.","tags":["User"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/user/organizations/route.ts"}},"/api/v1/user/profile":{"put":{"operationId":"putUserProfile","summary":"PUT /api/v1/user/profile","tags":["User"],"security":[{"BearerAuth":[]}],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{},"avatar_url":{}},"additionalProperties":true}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/user/profile/route.ts"}},"/api/v1/user/subscription":{"get":{"operationId":"getUserSubscription","summary":"GET /api/v1/user/subscription","tags":["User"],"security":[{"ApiKeyAuth":[]},{"OAuth2Auth":[]},{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"monthly API limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds until the monthly allowance resets.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"rate limit unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/user/subscription/route.ts"}},"/api/v1/user/usage-notifications":{"get":{"operationId":"getUserUsageNotifications","summary":"GET /api/v1/user/usage-notifications","tags":["User"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/user/usage-notifications/route.ts"},"put":{"operationId":"putUserUsageNotifications","summary":"PUT /api/v1/user/usage-notifications","tags":["User"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/user/usage-notifications/route.ts"},"post":{"operationId":"postUserUsageNotifications","summary":"POST /api/v1/user/usage-notifications","tags":["User"],"security":[{"BearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/user/usage-notifications/route.ts"}},"/api/v1/vendors/1099-threshold":{"get":{"operationId":"getVendors1099Threshold","summary":"GET /api/v1/vendors/1099-threshold","tags":["vendors"],"security":[{"ApiKeyAuth":[]},{"OAuth2Auth":[]},{"BearerAuth":[]}],"parameters":[{"name":"tax_year","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"monthly API limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Monthly request allowance for the organization.","schema":{"type":"integer","example":1000}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current UTC month.","schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the monthly allowance resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds until the monthly allowance resets.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"rate limit unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"x-eonebill-source":"src/app/api/v1/vendors/1099-threshold/route.ts"}}},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"Organization API key using the eob_ prefix."},"OAuth2Auth":{"type":"oauth2","description":"OAuth 2.1 authorization-code flow with PKCE, explicit consent, and organization-scoped access.","flows":{"authorizationCode":{"authorizationUrl":"https://www.eonebill.ai/api/auth/oauth2/authorize","tokenUrl":"https://www.eonebill.ai/api/auth/oauth2/token","refreshUrl":"https://www.eonebill.ai/api/auth/oauth2/token","scopes":{"invoices:read":"View invoices.","invoices:write":"Create and edit invoice drafts.","customers:read":"View customers.","customers:write":"Create and edit customers.","signatures:read":"View signature status.","vendors1099:read":"View vendor 1099 status.","usage:read":"View plan and API usage.","credits:read":"View credit balance.","documents:read":"View recent document metadata."}}}},"BearerAuth":{"type":"http","scheme":"bearer","description":"Bearer access token for an authenticated user session."}},"schemas":{"SuccessResponse":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean","const":true},"data":{}},"additionalProperties":true},"ErrorResponse":{"type":"object","required":["success","error"],"properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"additionalProperties":true}},"additionalProperties":false}}}}
