{"openapi":"3.1.0","info":{"title":"POST /api/v1/deferred-revenue/{deferral_id}/periods/{period_id}","version":"1.0.0","description":"Fill in a period's numerator"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/deferred-revenue/{deferral_id}/periods/{period_id}":{"post":{"tags":["deferred-revenue"],"summary":"Fill in a period's numerator","description":"Enter the units burned down in a period so it can post.","operationId":"set_period_units_api_v1_deferred_revenue__deferral_id__periods__period_id__post","parameters":[{"name":"deferral_id","in":"path","required":true,"schema":{"type":"string","title":"Deferral Id"}},{"name":"period_id","in":"path","required":true,"schema":{"type":"string","title":"Period Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetPeriodUnitsRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_InvoiceDeferralResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"detail":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"example":{"detail":"Not authenticated"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"detail":"Not enough permissions"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"detail":"Resource not found"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"DeferralMethodEnum":{"type":"string","enum":["straight_line","custom"],"title":"DeferralMethodEnum","description":"How each period's numerator is filled in."},"DeferralPeriodResponse":{"properties":{"id":{"type":"string","title":"Id"},"sequence":{"type":"integer","title":"Sequence","description":"1-based position in the schedule"},"period_start":{"type":"string","format":"date","title":"Period Start"},"period_end":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Period End","description":"Date the entry posts on. NULL while the period is parked awaiting its numerator."},"units":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Units"},"amount_cents":{"type":"integer","title":"Amount Cents"},"recognized":{"type":"boolean","title":"Recognized"},"recognized_at":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Recognized At"},"journal_entry_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Journal Entry Id"}},"type":"object","required":["id","sequence","period_start","amount_cents","recognized"],"title":"DeferralPeriodResponse","description":"One recognition period of a deferral schedule."},"DeferralStatusEnum":{"type":"string","enum":["active","completed","cancelled"],"title":"DeferralStatusEnum","description":"Lifecycle of a deferral."},"DeferralUnitEnum":{"type":"string","enum":["months","hours","custom"],"title":"DeferralUnitEnum","description":"Denominator unit the deferral burns down against."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"InvoiceDeferralResponse":{"properties":{"id":{"type":"string","title":"Id"},"invoice_id":{"type":"string","title":"Invoice Id"},"invoice_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Number"},"customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Id"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name"},"deferred_amount_cents":{"type":"integer","title":"Deferred Amount Cents"},"recognized_cents":{"type":"integer","title":"Recognized Cents"},"remaining_cents":{"type":"integer","title":"Remaining Cents"},"currency":{"type":"string","title":"Currency"},"unit":{"$ref":"#/components/schemas/DeferralUnitEnum"},"method":{"$ref":"#/components/schemas/DeferralMethodEnum"},"total_units":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Total Units"},"recognized_units":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Recognized Units"},"period_count":{"type":"integer","title":"Period Count"},"start_date":{"type":"string","format":"date","title":"Start Date"},"revenue_ledger_name":{"type":"string","title":"Revenue Ledger Name"},"status":{"$ref":"#/components/schemas/DeferralStatusEnum"},"booking_journal_entry_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Booking Journal Entry Id"},"reversal_journal_entry_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reversal Journal Entry Id"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"periods":{"items":{"$ref":"#/components/schemas/DeferralPeriodResponse"},"type":"array","title":"Periods","default":[]}},"type":"object","required":["id","invoice_id","deferred_amount_cents","recognized_cents","remaining_cents","currency","unit","method","total_units","recognized_units","period_count","start_date","revenue_ledger_name","status"],"title":"InvoiceDeferralResponse","description":"A deferred invoice and the state of its recognition schedule."},"SetPeriodUnitsRequest":{"properties":{"units":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Units","description":"Numerator burned down in this period"},"recognition_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Recognition Date","description":"Date the entry should post on. Defaults to the period's end. Once this date has passed the entry posts on the next run."},"post_now":{"type":"boolean","title":"Post Now","description":"Post immediately when the period is already due","default":true}},"type":"object","required":["units"],"title":"SetPeriodUnitsRequest","description":"Fill in a period's numerator so it becomes postable."},"SuccessEnvelope_InvoiceDeferralResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/InvoiceDeferralResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[InvoiceDeferralResponse]"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}