{"openapi":"3.1.0","info":{"title":"Tomanic SCF — Core API","version":"2.22.1","description":"API هستهٔ پلتفرم تامین مالی زنجیرهٔ تامین تومانیک. لایهٔ ارکستراسیون چندابزاری (گام/برات/چک/تنزیل پویا) با راستی‌آزماییِ دوریلی، دفترکل دوطرفه و کنترل‌های رگولاتوری. تومانیک طرفِ عقدِ اعتباری نیست؛ اجرا از مسیرِ بانک/نهادِ مجاز است.","contact":{"name":"تومانیک SCF","url":"https://scf.tomanic.ir"},"license":{"name":"Proprietary"}},"servers":[{"url":"https://scf.tomanic.ir/api/v1","description":"Production"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Auth","description":"احراز هویت و نشست (JWT)"},{"name":"Invoices","description":"فاکتور و درخواست تامین مالی"},{"name":"Instruments","description":"ابزارهای اعتباری (گام/برات/چک) و چرخهٔ عمر"},{"name":"Funder","description":"بانک/فاندر — Originate-to-Book"},{"name":"Reports","description":"گزارش و Exportِ ممهور"},{"name":"FinIntel","description":"هوش مالی، ریتینگ، پرونده و نماهای تصمیم نقش‌محور"}],"paths":{"/auth/login":{"post":{"tags":["Auth"],"summary":"ورود و دریافت توکن","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}}},"responses":{"200":{"description":"توکن + پروفایل","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"401":{"description":"TMN-0401 اعتبار نامعتبر","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"TMN-0429 قفلِ موقتِ ورود","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/me":{"get":{"tags":["Auth"],"summary":"پروفایلِ نشستِ جاری","responses":{"200":{"description":"پروفایل","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Profile"}}}},"401":{"description":"نشست نامعتبر","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invoices":{"get":{"tags":["Invoices"],"summary":"فهرست فاکتورها (scope per-نقش)","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"submitted | anchor_queue | financeable | financing_locked | financed | settled"}],"responses":{"200":{"description":"آرایهٔ فاکتور","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Invoice"}}}}}}},"post":{"tags":["Invoices"],"summary":"ثبت فاکتور (تامین‌کننده)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceCreate"}}}},"responses":{"201":{"description":"فاکتورِ ثبت‌شده","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"400":{"description":"TMN-1xxx اعتبارسنجی/تکرار","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invoices/{id}/financing":{"post":{"tags":["Invoices"],"summary":"انتخاب مسیر نقدشوندگی","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["route"],"properties":{"route":{"type":"string","enum":["gam_discount","barat_discount","cheque_discount","hold"]}}}}}},"responses":{"200":{"description":"ابزارِ ایجادشده/وضعیت","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Instrument"}}}},"400":{"description":"TMN-1400/8101 وضعیت/سقفِ تمرکز","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"TMN-1404 فاکتور یافت نشد","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/instruments":{"get":{"tags":["Instruments"],"summary":"فهرست ابزارها (scope per-نقش)","parameters":[{"name":"state","in":"query","required":false,"schema":{"type":"string"},"description":"anchor_requested | issued | accepted | registered | discounted | matured | settled | cancelled"}],"responses":{"200":{"description":"آرایهٔ ابزار","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Instrument"}}}}}}}},"/funder/deals":{"get":{"tags":["Funder"],"summary":"صف معاملاتِ آمادهٔ بوک با پروندهٔ دیجیتال","responses":{"200":{"description":"آرایهٔ معامله","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/FunderDeal"}}}}},"403":{"description":"TMN-0403 فقط فاندر","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/funder/deals/{id}/book":{"post":{"tags":["Funder"],"summary":"بوکِ معامله (صدورِ اتمیک + مصرفِ ظرفیتِ خط)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["nationalRef"],"properties":{"nationalRef":{"type":"string","description":"شناسهٔ ملیِ صدورِ گام"}}}}}},"responses":{"200":{"description":"ابزارِ صادرشده","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Instrument"}}}},"400":{"description":"TMN-2400/8002 وضعیت/ظرفیت","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/reports/program":{"get":{"tags":["Reports"],"summary":"گزارش برنامه (انکر/عملیات)","responses":{"200":{"description":"خلاصهٔ برنامه","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProgramReport"}}}}}}},"/fin-intel/buyer-cockpit":{"get":{"tags":["FinIntel"],"summary":"کابین ارزش خریدار/انکر (program-scoped)","responses":{"200":{"description":"ریسک زنجیره، سناریوهای سرمایه در گردش و بنچمارک امن","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuyerCockpit"}}}},"403":{"description":"TMN-6011 فقط انکر","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/fin-intel/supplier-intel":{"get":{"tags":["FinIntel"],"summary":"هوش تامین‌کننده (tenant-scoped)","responses":{"200":{"description":"Runway نقدی، شبیه‌ساز تنزیل و مسیر ارتقای ریتینگ","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierIntel"}}}},"403":{"description":"TMN-6011 فقط تامین‌کننده","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/fin-intel/dossiers/{id}/credit-memo":{"get":{"tags":["FinIntel"],"summary":"پیش‌نویس Credit-Memo برای فاندر دارای grant فعال","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Memo قالب‌محور از بلوک‌های grantشده؛ تصمیم خودکار نیست","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditMemo"}}}},"403":{"description":"TMN-6011 فقط فاندر","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"TMN-6031 پرونده‌ای با دسترسی معتبر یافت نشد","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/export/program":{"get":{"tags":["Reports"],"summary":"بستهٔ رگولاتوریِ ممهور (SHA-256 seal)","responses":{"200":{"description":"بستهٔ ممهور","content":{"application/json":{"schema":{"type":"object","properties":{"exportType":{"type":"string"},"seal":{"type":"string","description":"SHA-256 محتوای کانونی"}}}}}}}}},"/export/deal/{id}":{"get":{"tags":["Reports"],"summary":"دوسیهٔ دیجیتالِ معامله (ممهور)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"دوسیهٔ ممهور"},"404":{"description":"TMN-2404 ابزار یافت نشد","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{"instrument.issued":{"post":{"summary":"صدورِ ابزار","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEnvelope"}}}},"responses":{"200":{"description":"دریافت تایید شد"}}}},"instrument.settled":{"post":{"summary":"تسویهٔ نهاییِ ابزار","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEnvelope"}}}},"responses":{"200":{"description":"دریافت تایید شد"}}}},"recon.mismatch":{"post":{"summary":"مغایرتِ تسویه","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEnvelope"}}}},"responses":{"200":{"description":"دریافت تایید شد"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"توکنِ دریافتی از /auth/login در هدرِ Authorization: Bearer <token>"}},"schemas":{"Error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","example":"TMN-0403","description":"کدِ پایدارِ خطا — کاتالوگ در /errors.json"},"message":{"type":"string","example":"دسترسی مجاز نیست"}}},"LoginRequest":{"type":"object","required":["username","password"],"properties":{"username":{"type":"string"},"password":{"type":"string","format":"password"}}},"AuthResponse":{"type":"object","properties":{"token":{"type":"string"},"profile":{"$ref":"#/components/schemas/Profile"}}},"Profile":{"type":"object","properties":{"userId":{"type":"string"},"username":{"type":"string"},"role":{"type":"string","enum":["supplier_admin","anchor_admin","funder","ops","investor"]},"orgId":{"type":"string","nullable":true},"orgName":{"type":"string","nullable":true}}},"Invoice":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"number":{"type":"string"},"amountRls":{"type":"string","description":"ریالِ صحیح به‌صورت رشته (BigInt-safe)"},"issueDate":{"type":"string","description":"جلالی YYYY/MM/DD"},"dueDate":{"type":"string"},"status":{"type":"string"},"fingerprint":{"type":"string","description":"اثرانگشتِ ضدِ تامین‌مالیِ مضاعف"}}},"InvoiceCreate":{"type":"object","required":["number","amountRls","issueDate","dueDate"],"properties":{"number":{"type":"string"},"amountRls":{"type":"string"},"issueDate":{"type":"string"},"dueDate":{"type":"string"}}},"Instrument":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["gam","barat","cheque"]},"state":{"type":"string"},"faceValueRls":{"type":"string"},"nationalRef":{"type":"string","nullable":true},"maturityDate":{"type":"string"},"funderOrgId":{"type":"string","nullable":true}}},"FunderDeal":{"type":"object","properties":{"instrumentId":{"type":"string"},"invoiceNumber":{"type":"string"},"faceValueRls":{"type":"string"},"supplier":{"type":"string"},"anchor":{"type":"string"},"dualRailVerified":{"type":"boolean"},"creditGrade":{"type":"string","nullable":true},"anchorExposureRls":{"type":"string"}}},"ProgramReport":{"type":"object","properties":{"program":{"type":"object"},"suppliers":{"type":"integer"},"totalRls":{"type":"string"},"financedRls":{"type":"string"},"platformFees":{"type":"object"}}},"BuyerCockpit":{"type":"object","properties":{"program":{"type":"object"},"valueCenter":{"type":"object"},"suppliers":{"type":"array","items":{"type":"object"}},"workingCapitalScenarios":{"type":"array","items":{"type":"object"}},"benchmark":{"type":"object"}}},"SupplierIntel":{"type":"object","properties":{"org":{"type":"object"},"period":{"type":"string","nullable":true},"rating":{"type":"object","nullable":true},"liquidity":{"type":"object"},"discountSimulator":{"type":"object"},"improvementPlan":{"type":"object"},"benchmark":{"type":"object"}}},"CreditMemo":{"type":"object","properties":{"dossierId":{"type":"string"},"version":{"type":"integer"},"grantedBlocks":{"type":"array","items":{"type":"integer"}},"borrower":{"type":"object"},"rating":{"type":"object","nullable":true},"financialSnapshot":{"type":"object"},"memo":{"type":"object"},"checks":{"type":"array","items":{"type":"object"}},"latestDecision":{"type":"object","nullable":true}}},"WebhookEnvelope":{"type":"object","required":["event","id","at","data"],"properties":{"event":{"type":"string","example":"instrument.issued"},"id":{"type":"string","description":"شناسهٔ یکتای رویداد (idempotency)"},"at":{"type":"string","format":"date-time"},"entityRef":{"type":"string","example":"instrument:uuid"},"data":{"type":"object"}}}}}}