Skip to main content
Financial Data & Planning

Generate and persist a backtest-selected forecast

POST /planning/forecasts

Contract

Authentication
Bearer credential required
Required scope
planning:forecast:create
Status
Published

Request body

application/json ยท required
{
    "metric": "string",
    "company_id": 1,
    "horizon": 6,
    "reason": "string"
}

Code examples

These examples compose a request only. Public reference pages never transmit your credential or execute the operation.

curl

curl -X POST \
  -H "Authorization: Bearer $FINANCEGPT_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  --data '{
    "metric": "string",
    "company_id": 1,
    "horizon": 6,
    "reason": "string"
}' \
  "https://financegpt.dev/api/v2/planning/forecasts"

javascript

const response = await fetch("https:\/\/financegpt.dev\/api\/v2\/planning\/forecasts", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${FINANCEGPT_API_KEY}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "metric": "string",
    "company_id": 1,
    "horizon": 6,
    "reason": "string"
}),
});
const data = await response.json();

python

import json
import os
import requests

response = requests.request(
    'POST',
    'https://financegpt.dev/api/v2/planning/forecasts',
    headers={
        'Authorization': 'Bearer ' + os.environ['FINANCEGPT_API_KEY'],
        'Accept': 'application/json',
    },
    json=json.loads('{"metric":"string","company_id":1,"horizon":6,"reason":"string"}'),
)
response.raise_for_status()
print(response.json())

php

<?php
$ch = curl_init('https://financegpt.dev/api/v2/planning/forecasts');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer '.getenv('FINANCEGPT_API_KEY'),
        'Accept: application/json',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode(array (
  'metric' => 'string',
  'company_id' => 1,
  'horizon' => 6,
  'reason' => 'string',
)),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;

Responses

Status Description
201 Forecast generated
422 Insufficient history or invalid input

Authority boundary

A developer credential proves application identity and permits only its scopes. It does not grant model promotion, policy override, QLM rebinding, or Financial Actions execution authority unless those separate controls are satisfied.

planning:forecast:create

Machine-readable sources