Create forecast
https://api.faraday.ai/v1/forecastsAdd a new forecast.
This feature is experimental and subject to change. To enable this feature, contact your account manager.
Authentication
Provide your API key in the Authorization header. You can find your API key in the Settings page of the dashboard.
Authorization: Bearer YOUR_TOKENBody
The definition of the new forecast
currencystringThe ISO 4217 code of the currency the forecast is expressed in. Values are summed as recorded; nothing is excluded or converted.
"USD"^[A-Z]{3}$currency_property_namestringName of the property of stream_name holding each event's currency code. Informational: no event is excluded or converted because of its currency; it lets the forecast report how much value is recorded in currencies other than currency.
"currency"deduction_property_namestringName of a numeric property of stream_name whose absolute value is subtracted from stream_property_name on the same event before summing, for refunds that are recorded on the original event rather ...
"amount_refunded"eligible_cohort_idstring<uuid>Optional cohort that restricts which entries the model learns from: when set, only entries whose person is currently a member of the cohort are used for training. It does not restrict scoring. Omit it to train on every entry.
entry_key_property_namestringName of a property present on both entry_stream_name and stream_name that identifies the entry, such as a subscription or order id. When set, each distinct value is its own entry and value is attr...
"subscription_id"Name of the stream whose events are the entries. Each event starts a horizon at its own date. May be the same stream as stream_name. Without entry_key_property_name, each person's first event on this stream is their entry.
"stripe_subscriptions"(Parameters used to POST a new value of the ForecastHorizon type.)
How far past each entry's event the forecast reaches.
not allowedHuman-readable label for this forecast. Unique within the account, case-insensitive.
"Subscription value, 456 days"^(?!\s*$).+64predictorsobject(Parameters used to POST a new value of the ForecastPredictors type.)
Provides control over the data used during modeling for a forecast.
not allowedstream_conditionsarray[object]Conditions on the properties of stream_name. When set, only events that satisfy every condition count toward the value; when omitted, every event on the stream counts. Each property must exist on ...
Name of the stream whose events carry the value to forecast.
"stripe_charges"Name of the numeric property of stream_name to sum. Negative values are summed as they are, so refunds recorded as negative events net correctly. The stream property's format (currency_cents or `c...
"amount"Responses
201The new forecast
archived_atstring<date-time>If not null, this resource will no longer receive updates, but will still be visable.
When this resource was created.
currencystringThe ISO 4217 code of the currency the forecast is expressed in. Values are summed as recorded; nothing is excluded or converted.
"USD"^[A-Z]{3}$currency_property_namestringName of the property of stream_name holding each event's currency code. Informational: no event is excluded or converted because of its currency; it lets the forecast report how much value is recorded in currencies other than currency.
"currency"deduction_property_namestringName of a numeric property of stream_name whose absolute value is subtracted from stream_property_name on the same event before summing, for refunds that are recorded on the original event rather ...
"amount_refunded"eligible_cohort_idstring<uuid>Optional cohort that restricts which entries the model learns from: when set, only entries whose person is currently a member of the cohort are used for training. It does not restrict scoring. Omit it to train on every entry.
eligible_cohort_namestringHuman-readable label of the eligible cohort. See /cohorts/{eligible_cohort_id} to edit the eligible cohort or view additional details.
entry_key_property_namestringName of a property present on both entry_stream_name and stream_name that identifies the entry, such as a subscription or order id. When set, each distinct value is its own entry and value is attr...
"subscription_id"Name of the stream whose events are the entries. Each event starts a horizon at its own date. May be the same stream as stream_name. Without entry_key_property_name, each person's first event on this stream is their entry.
"stripe_subscriptions"How far past each entry's event the forecast reaches.
not allowedA unique ID for this resource.
last_read_input_atstring<date-time>The last time this resource's input was read.
last_updated_config_atstring<date-time>The last time this resource's configuration was updated. If this is more recent than last_updated_output_at, the resource will be rebuilt.
last_updated_output_atstring<date-time>The last time this resource successfully built.
Human-readable label for this forecast. Unique within the account, case-insensitive.
"Subscription value, 456 days"^(?!\s*$).+64predictorsobjectProvides control over the data used during modeling for a forecast.
not allowedreport_urlstringURL of an HTML report on the forecast's performance.
The type of this resource.
The current state of this resource and any updates.
"pending"new, starting, running, ready, errorstatus_changed_atstring<date-time>When the status of this resource was last updated.
status_errorstringIf this resource has status == "error", this will contain an error message.
stream_conditionsarray[object]Conditions on the properties of stream_name. When set, only events that satisfy every condition count toward the value; when omitted, every event on the stream counts. Each property must exist on ...
Name of the stream whose events carry the value to forecast.
"stripe_charges"Name of the numeric property of stream_name to sum. Negative values are summed as they are, so refunds recorded as negative events net correctly. The stream property's format (currency_cents or `c...
"amount"When this resource was last updated.
400The request was invalid.
A Faraday error code.
Some possible values include:
Generic HTTP Errors
- BAD_REQUEST: The request could not be validated.
- FORBIDDEN: You do not have permission to access the specified resour...
"ERROR_TYPE"BAD_REQUEST, FORBIDDEN, MAX_RESOURCES_REACHED, INTERNAL_SERVER_ERROR, INVALID_AUTHORIZATION, NOT_FOUND, MALFORMED_API_KEY, MISSING_API_KEY, EXPIRED_API_KEY, VALIDATION_FAILED, CONFLICT, QUOTA_EXCEEDEDA unique ID for this error. Please include this in bug reports.
"082f9513-901c-4308-8081-902a8fe22d7e"validationErrorsarray[object]JSON Schema validation errors, if any.
401No API key was supplied.
A Faraday error code.
Some possible values include:
Generic HTTP Errors
- BAD_REQUEST: The request could not be validated.
- FORBIDDEN: You do not have permission to access the specified resour...
"ERROR_TYPE"BAD_REQUEST, FORBIDDEN, MAX_RESOURCES_REACHED, INTERNAL_SERVER_ERROR, INVALID_AUTHORIZATION, NOT_FOUND, MALFORMED_API_KEY, MISSING_API_KEY, EXPIRED_API_KEY, VALIDATION_FAILED, CONFLICT, QUOTA_EXCEEDEDA unique ID for this error. Please include this in bug reports.
"082f9513-901c-4308-8081-902a8fe22d7e"validationErrorsarray[object]JSON Schema validation errors, if any.
403Access to this resource was forbidden.
A Faraday error code.
Some possible values include:
Generic HTTP Errors
- BAD_REQUEST: The request could not be validated.
- FORBIDDEN: You do not have permission to access the specified resour...
"ERROR_TYPE"BAD_REQUEST, FORBIDDEN, MAX_RESOURCES_REACHED, INTERNAL_SERVER_ERROR, INVALID_AUTHORIZATION, NOT_FOUND, MALFORMED_API_KEY, MISSING_API_KEY, EXPIRED_API_KEY, VALIDATION_FAILED, CONFLICT, QUOTA_EXCEEDEDA unique ID for this error. Please include this in bug reports.
"082f9513-901c-4308-8081-902a8fe22d7e"validationErrorsarray[object]JSON Schema validation errors, if any.
404The requested resource ID was not found.
A Faraday error code.
Some possible values include:
Generic HTTP Errors
- BAD_REQUEST: The request could not be validated.
- FORBIDDEN: You do not have permission to access the specified resour...
"ERROR_TYPE"BAD_REQUEST, FORBIDDEN, MAX_RESOURCES_REACHED, INTERNAL_SERVER_ERROR, INVALID_AUTHORIZATION, NOT_FOUND, MALFORMED_API_KEY, MISSING_API_KEY, EXPIRED_API_KEY, VALIDATION_FAILED, CONFLICT, QUOTA_EXCEEDEDA unique ID for this error. Please include this in bug reports.
"082f9513-901c-4308-8081-902a8fe22d7e"validationErrorsarray[object]JSON Schema validation errors, if any.
409The request was formatted correctly, but conflicted with an existing resource.
A Faraday error code.
Some possible values include:
Generic HTTP Errors
- BAD_REQUEST: The request could not be validated.
- FORBIDDEN: You do not have permission to access the specified resour...
"ERROR_TYPE"BAD_REQUEST, FORBIDDEN, MAX_RESOURCES_REACHED, INTERNAL_SERVER_ERROR, INVALID_AUTHORIZATION, NOT_FOUND, MALFORMED_API_KEY, MISSING_API_KEY, EXPIRED_API_KEY, VALIDATION_FAILED, CONFLICT, QUOTA_EXCEEDEDA unique ID for this error. Please include this in bug reports.
"082f9513-901c-4308-8081-902a8fe22d7e"validationErrorsarray[object]JSON Schema validation errors, if any.
500An internal server error occurred.
A Faraday error code.
Some possible values include:
Generic HTTP Errors
- BAD_REQUEST: The request could not be validated.
- FORBIDDEN: You do not have permission to access the specified resour...
"ERROR_TYPE"BAD_REQUEST, FORBIDDEN, MAX_RESOURCES_REACHED, INTERNAL_SERVER_ERROR, INVALID_AUTHORIZATION, NOT_FOUND, MALFORMED_API_KEY, MISSING_API_KEY, EXPIRED_API_KEY, VALIDATION_FAILED, CONFLICT, QUOTA_EXCEEDEDA unique ID for this error. Please include this in bug reports.
"082f9513-901c-4308-8081-902a8fe22d7e"validationErrorsarray[object]JSON Schema validation errors, if any.
Tags
Test request
Request snippet
curl -X POST 'https://api.faraday.ai/v1/forecasts' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-d '{
"currency": "USD",
"currency_property_name": "currency",
"deduction_property_name": "amount_refunded",
"eligible_cohort_id": "123e4567-e89b-12d3-a456-426614174000",
"entry_key_property_name": "subscription_id",
"entry_stream_name": "stripe_subscriptions",
"horizon": {
"max_days": 456
},
"name": "Subscription value, 456 days",
"predictors": {
"max_observation_date": "2024-01-01"
},
"stream_conditions": [
{
"_eq": "string",
"_gt": 0,
"_gte": 0,
"_in": [
"string"
],
"_lt": 0,
"_lte": 0,
"_matches": "string",
"_nin": [
"string"
],
"_nnull": true,
"_null": true,
"_on_or_after": "2024-01-01",
"_on_or_before": "2024-01-01",
"optional": true,
"property": "string"
}
],
"stream_name": "stripe_charges",
"stream_property_name": "amount"
}'Example response
{
"archived_at": "2024-01-01T12:00:00Z",
"created_at": "2024-01-01T12:00:00Z",
"currency": "USD",
"currency_property_name": "currency",
"deduction_property_name": "amount_refunded",
"eligible_cohort_id": "123e4567-e89b-12d3-a456-426614174000",
"eligible_cohort_name": "string",
"entry_key_property_name": "subscription_id",
"entry_stream_name": "stripe_subscriptions",
"horizon": {
"max_days": 456
},
"id": "123e4567-e89b-12d3-a456-426614174000",
"last_read_input_at": "2024-01-01T12:00:00Z",
"last_updated_config_at": "2024-01-01T12:00:00Z",
"last_updated_output_at": "2024-01-01T12:00:00Z",
"name": "Subscription value, 456 days",
"predictors": {
"max_observation_date": "2024-01-01"
},
"report_url": "string",
"resource_type": "string",
"status": "pending",
"status_changed_at": "2024-01-01T12:00:00Z",
"status_error": "string",
"stream_conditions": [
{
"_eq": "string",
"_gt": 0,
"_gte": 0,
"_in": [
"string"
],
"_lt": 0,
"_lte": 0,
"_matches": "string",
"_nin": [
"string"
],
"_nnull": true,
"_null": true,
"_on_or_after": "2024-01-01",
"_on_or_before": "2024-01-01",
"optional": true,
"property": "string"
}
],
"stream_name": "stripe_charges",
"stream_property_name": "amount",
"updated_at": "2024-01-01T12:00:00Z"
}