# Forecast

## Get Plan Forecast

> Retrieve a forecast of upcoming plan payments based on the specified schedule parameters.

```json
{"openapi":"3.0.1","info":{"title":"Recurring Payments API","version":"2.0"},"paths":{"/rest/v2/plan-forecast":{"get":{"tags":["Forecast"],"summary":"Get Plan Forecast","description":"Retrieve a forecast of upcoming plan payments based on the specified schedule parameters.","operationId":"get","parameters":[{"name":"api-key","in":"header","description":"An access API key issued to you by Xplor Pay.","required":true,"schema":{"type":"string"}},{"name":"start-date","in":"query","description":"Specifies the start date for the forecast period. \r\nFormat: YYYY-MM-DD.","required":true},{"name":"frequency","in":"query","description":"Specifies how often the plan is billed. Supported values include day, week, and monthly.","required":true,"schema":{"type":"string","enum":["WEEKLY,MONTHLY,YEARLY"]}},{"name":"frequency-day","in":"query","description":"\t\r\nSpecifies the billing day based on the frequency.\r\n\r\nWeekly: Day of the week (1-7).\r\n\r\nMonthly/Yearly: Day of the month (1-31).","required":true,"schema":{"type":"string","enum":["range[1,28]"]}},{"name":"frequency-week","in":"query","description":"Required when frequency is weekly. Specifies the weeks between payments.","schema":{"type":"string","enum":["range[1,52]"]}},{"name":"frequency-month","in":"query","description":"Specifies the month interval based on frequency.\r\n\r\nMonthly: Number of months between payments.\r\n\r\nYearly: Month of the year (1-12) when the payment occurs.","schema":{"type":"string","enum":["range[1,12]"]}},{"name":"end-date","in":"query","description":"Specifies the end date for the forecast period. Required when forecasting monthly plans.\r\nFormat: YYYY-MM-DD."}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForecastResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ForecastResponsePayload"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}},"application/xml":{"schema":{"$ref":"#/components/schemas/ErrorPayloadResponsePayload"}}}}}}}},"components":{"schemas":{"ForecastResponsePayload":{"type":"object","properties":{"forecast":{"$ref":"#/components/schemas/forecast"},"payloadType":{"type":"string","description":"Type of payload returned in the response.","xml":{"name":"type","attribute":true}}},"description":"payload","xml":{"name":"payload"}},"forecast":{"type":"object","properties":{"dates":{"type":"array","description":"List of scheduled payment dates included in the forecast.","items":{"type":"string","description":"List of scheduled payment dates included in the forecast."}}},"description":"forecast","xml":{"name":"forecast"}},"ErrorPayloadResponsePayload":{"type":"object","properties":{"error":{"$ref":"#/components/schemas/ErrorPayload"},"payloadType":{"type":"string","description":"Type of payload returned in the response.","xml":{"name":"type","attribute":true}}},"description":"Payload","xml":{"name":"payload"}},"ErrorPayload":{"type":"object","properties":{"error-message":{"type":"string","description":"Describes the reason for the error."},"result-code":{"type":"string","description":"Numeric code that identifies the type of error returned by the request."},"time-stamp":{"type":"string","description":"Date and time when the error occurred, ISO 8601 format (UTC)."}},"xml":{"name":"error"}}}}}
```
