{"basePath":"/ai","definitions":{"agent":{"description":"agent information","properties":{"approvals":{"description":"Pending approval requests, operations awaiting your decision, ordered by the request timestamp.","items":{"$ref":"#/definitions/agent.approval"},"readOnly":true,"type":"array"},"approvals_count":{"description":"Number of pending approval requests.","readOnly":true,"type":"integer"},"blocked":{"$ref":"#/definitions/item.blocked"},"cid":{"$ref":"#/definitions/item.cid"},"connectors_count":{"description":"Number of connectors assigned to the agent.","readOnly":true,"type":"integer"},"created":{"$ref":"#/definitions/item.btime"},"duration":{"description":"Total agent execution time, in seconds.","readOnly":true,"type":"number"},"enabled":{"$ref":"#/definitions/item.enabled"},"executed":{"description":"Time of the last agent reasoning step, UNIX timestamp.","readOnly":true,"type":"number","x-view-type":"datetime"},"id":{"$ref":"#/definitions/item.id"},"messages_read":{"description":"Read marker of the agent chat, the newest history record timestamp the account has read, 0 until the first marker is published, set via the messages/read method.","readOnly":true,"type":"number","x-view-type":"datetimezero"},"metadata":{"$ref":"#/definitions/metadata"},"name":{"$ref":"#/definitions/item.name"},"sleep":{"description":"Time when the sleeping agent wakes up for its next reasoning step, UNIX timestamp, 0 while no wake-up is scheduled, a past time means the wake-up is due.","readOnly":true,"type":"number","x-view-type":"datetimezero"},"status":{"description":"Current standing status of the agent, what it is doing or waiting on right now.","readOnly":true,"type":"string"},"steps":{"description":"Number of reasoning steps completed by the agent.","readOnly":true,"type":"integer"},"title":{"description":"Title the agent maintains for itself to reflect its current task.","readOnly":true,"type":"string"},"unread":{"description":"The agent chat has activity newer than the messages_read marker, derived from the updated and messages_read fields, false until the chat first becomes unread.","readOnly":true,"type":"boolean"},"updated":{"description":"Agent runtime state last update UNIX timestamp.","readOnly":true,"type":"number","x-view-type":"datetime"},"waiting":{"description":"The agent declared it is waiting for external input to continue; an agent stalled on a pending approval reports that via approvals_count instead.","readOnly":true,"type":"boolean"}},"type":"object"},"agent.approval":{"description":"Approval request, an operation the agent executes only after your decision.","properties":{"data":{"additionalProperties":true,"description":"Operation arguments, rendered against the schema of the operation type.","type":"object"},"expires":{"description":"Time when the unresolved request expires and is rejected automatically with the \"timeouted\" status, UNIX timestamp.","type":"number","x-view-type":"datetime"},"step":{"description":"Reasoning step that produced the operation.","type":"integer"},"text":{"description":"Operation details written by the agent, when present.","type":"string"},"timestamp":{"description":"Approval request id, the timestamp of the pending request.","type":"number"},"title":{"description":"Short human-readable summary of the operation.","type":"string"},"type":{"description":"Operation type, its arguments schema is declared in the operations map of the connector type, retrieve it with [GET /ai/connector-types/all](/docs/#/ai/connector-types); the same name is the binding field of the ACL rule controlling the operation.","type":"string"}},"type":"object","x-view-order":["timestamp","type","title","text","data","step","expires"]},"agent.approval.resolution":{"description":"Resolution of one pending approval request.","properties":{"reason":{"description":"Rejection reason recorded for the agent, applies to a rejected request and is ignored for a granted one.","maxLength":500,"minLength":1,"type":"string"},"status":{"description":"The decision, a granted operation executes, a rejected one is discarded.","enum":["granted","rejected"],"type":"string"},"timestamp":{"description":"Approval request id, the timestamp of the pending request in the \"approvals\" field of the agent.","minimum":0.000001,"type":"number"}},"required":["timestamp","status"],"type":"object","x-view-order":["timestamp","status","reason"]},"agent.approval.resolution.result":{"description":"One applied approval resolution.","properties":{"id":{"$ref":"#/definitions/item.id"},"status":{"description":"The applied decision.","enum":["granted","rejected"],"type":"string"},"timestamp":{"description":"Approval request id.","type":"number"}},"type":"object","x-view-order":["id","timestamp","status"]},"agent.connector":{"description":"agent connector assignment information","properties":{"agent_id":{"$ref":"#/definitions/item.id"},"agents_count":{"description":"Number of agents the connector is assigned to.","readOnly":true,"type":"integer"},"auto_created":{"$ref":"#/definitions/subitem.auto_created"},"blocked":{"$ref":"#/definitions/item.blocked"},"cid":{"$ref":"#/definitions/item.cid"},"configuration":{"$ref":"#/definitions/connector.configuration"},"connector_id":{"$ref":"#/definitions/item.id"},"created":{"$ref":"#/definitions/item.btime"},"enabled":{"$ref":"#/definitions/item.enabled"},"fields":{"additionalProperties":true,"description":"Binding fields of the assignment, one ACL rule (\"ask\", \"allow\" or \"deny\") per operation declared by the connector type.","type":"object"},"item_schema":{"$ref":"#/definitions/connector.item_schema"},"metadata":{"$ref":"#/definitions/metadata"},"name":{"$ref":"#/definitions/item.name"},"type_id":{"$ref":"#/definitions/connector.type_id"}},"type":"object"},"agent.connector.fields-object":{"additionalProperties":true,"description":"Binding fields of the assignment, one ACL rule (\"ask\", \"allow\" or \"deny\") per operation declared by the connector type.","type":"object"},"agent.connector.post":{"properties":{"fields":{"additionalProperties":true,"default":{},"description":"Binding fields of the assignment, one ACL rule (\"ask\", \"allow\" or \"deny\") per operation declared by the connector type.","type":"object"}},"type":"object","x-view-order":["fields"]},"agent.connectors":{"properties":{"errors":{"$ref":"#/definitions/errors"},"result":{"description":"Agent connectors collection","items":{"$ref":"#/definitions/agent.connector"},"type":"array"}},"type":"object"},"agent.history.record":{"description":"Agent history record, its fields depend on the record type and on the requested fields.","properties":{"data":{"additionalProperties":true,"description":"Record payload, its content is specific to the record type.","type":"object"},"level":{"description":"Record level - 7 for the agent activity, 8 for an executed operation, 10 for a communication message.","type":"integer"},"reason":{"description":"Failure or rejection reason of the operation, present when it did not succeed.","type":"string"},"status":{"description":"Operation status, present on the executed operation records, e.g. \"success\", \"failed\", \"rejected\", \"timeouted\".","type":"string"},"step":{"description":"Reasoning step the record was produced by, absent for the records of external origin.","type":"integer"},"text":{"description":"Record text, the message body for the communication records.","type":"string"},"timestamp":{"description":"Record id, its UNIX timestamp key in the agent history.","type":"number"},"title":{"description":"Short record title.","type":"string"},"type":{"description":"Record type, the agent itself writes \"message_from_principal\" and \"message_to_principal\" (the conversation); each assigned connector contributes its own record types, e.g. \"flespi_api_call_executed\".","type":"string"}},"type":"object","x-view-order":["timestamp","type","level","title","text","step"]},"agent.history.result":{"properties":{"errors":{"$ref":"#/definitions/errors"},"result":{"description":"Collection of the selected history records.","items":{"$ref":"#/definitions/agent.history.record"},"type":"array"}},"type":"object"},"agent.history.select":{"description":"History records selection parameters, an empty selection returns all records.","properties":{"count":{"description":"Maximum quantity of returned records, zero does not limit the selection.","type":"integer"},"fields":{"description":"Return only the listed record fields, CSV of names with wildcards allowed, e.g. \"timestamp,type,title\".","type":"string"},"filter":{"description":"Return only records matching the filter expression, e.g. \"type=message_from_principal\".","type":"string"},"from":{"description":"Left inclusive timestamp key of the records, zero leaves the range open.","minimum":0,"type":"number"},"reverse":{"default":false,"description":"true selects the records in the reverse order, from the most recent one.","type":"boolean"},"to":{"description":"Right inclusive timestamp key of the records, zero leaves the range open.","minimum":0,"type":"number"}},"type":"object","x-view-order":["from","to","count","reverse","filter","fields"]},"agent.marker":{"description":"Published read marker.","properties":{"id":{"$ref":"#/definitions/item.id"},"timestamp":{"description":"The published read marker value.","type":"number"}},"type":"object","x-view-order":["id","timestamp"]},"agent.message":{"description":"Queued message.","properties":{"id":{"$ref":"#/definitions/item.id"},"timestamp":{"description":"Queued message id, the UNIX timestamp key of the agent history record.","type":"number"}},"type":"object","x-view-order":["id","timestamp"]},"agent.message.post":{"properties":{"name":{"description":"Sender display name shown in the agent history.","maxLength":128,"type":"string"},"reply_to":{"description":"Timestamp id of the message this message replies to.","type":"number"},"text":{"description":"Message text.","maxLength":20000,"minLength":1,"type":"string"}},"required":["text"],"type":"object","x-view-order":["text","name","reply_to"]},"agent.messages.pending.delete":{"properties":{"timestamp":{"description":"Pending message id, the arrival timestamp key of its pending state topic.","minimum":0.000001,"type":"number"}},"required":["timestamp"],"type":"object"},"agent.messages.read.post":{"properties":{"timestamp":{"description":"Read marker value, the timestamp of the newest history record the account has read.","minimum":1,"type":"number"}},"required":["timestamp"],"type":"object"},"agent.post":{"properties":{"enabled":{"$ref":"#/definitions/item.enabled-default"},"metadata":{"$ref":"#/definitions/metadata"},"name":{"$ref":"#/definitions/item.name"}},"required":["name"],"title":"Agent","type":"object","x-view-order":["name","enabled","metadata"]},"agent.retraction":{"description":"Retracted pending message.","properties":{"id":{"$ref":"#/definitions/item.id"},"timestamp":{"description":"Retracted pending message id, its arrival timestamp key.","type":"number"}},"type":"object","x-view-order":["id","timestamp"]},"agents.approvals.result":{"properties":{"errors":{"$ref":"#/definitions/errors"},"result":{"description":"Collection of the resolved approval requests.","items":{"$ref":"#/definitions/agent.approval.resolution.result"},"type":"array"}},"type":"object"},"agents.markers.result":{"properties":{"errors":{"$ref":"#/definitions/errors"},"result":{"description":"Collection of published read markers.","items":{"$ref":"#/definitions/agent.marker"},"type":"array"}},"type":"object"},"agents.messages.result":{"properties":{"errors":{"$ref":"#/definitions/errors"},"result":{"description":"Collection of queued messages.","items":{"$ref":"#/definitions/agent.message"},"type":"array"}},"type":"object"},"agents.post":{"items":{"$ref":"#/definitions/agent.post"},"maxItems":128,"minItems":1,"title":"Agents array","type":"array"},"agents.put":{"properties":{"enabled":{"$ref":"#/definitions/item.enabled"},"metadata":{"$ref":"#/definitions/metadata"},"name":{"$ref":"#/definitions/item.name"}},"type":"object","x-view-order":["name","enabled","metadata"]},"agents.result":{"properties":{"errors":{"$ref":"#/definitions/errors"},"result":{"description":"Agents collection.","items":{"$ref":"#/definitions/agent"},"type":"array"}},"type":"object"},"agents.retractions.result":{"properties":{"errors":{"$ref":"#/definitions/errors"},"result":{"description":"Collection of retracted pending messages.","items":{"$ref":"#/definitions/agent.retraction"},"type":"array"}},"type":"object"},"api-method-schema.get":{"description":"API schema retrieval request","properties":{"link":{"description":"Full documentation link for the API method, e.g. \"https://flespi.io/docs/#/gw/channels/post_channels\".\n","maxLength":512,"minLength":1,"pattern":"^https://flespi\\.io/docs/#/[^\"\\s]+$","type":"string"}},"required":["link"],"type":"object"},"calc.interval.counter":{"anyOf":[{"$ref":"#/definitions/container.interval.counter.expression"},{"$ref":"#/definitions/container.interval.counter.dataset"},{"$ref":"#/definitions/container.interval.counter.route"},{"$ref":"#/definitions/container.interval.counter.datetime"},{"$ref":"#/definitions/container.interval.counter.parameter"},{"$ref":"#/definitions/container.interval.counter.message"},{"$ref":"#/definitions/container.interval.counter.interval"},{"$ref":"#/definitions/container.interval.counter.active"},{"$ref":"#/definitions/container.interval.counter.geofence"},{"$ref":"#/definitions/container.interval.counter.variable"},{"$ref":"#/definitions/container.interval.counter.specified"},{"$ref":"#/definitions/container.interval.counter.calculator"},{"$ref":"#/definitions/container.interval.counter.accumulator"}],"x-key-property":"type"},"calc.interval.counters":{"description":"[Intervals counters](https://flespi.com/kb/analytics-reports-and-events-engine#interval-counters), define how to calculate messsages inside each interval.\n","items":{"$ref":"#/definitions/calc.interval.counter"},"maxItems":50,"type":"array"},"calc.interval.selector":{"anyOf":[{"$ref":"#/definitions/container.interval.selector.expression"},{"$ref":"#/definitions/container.interval.selector.datetime"},{"$ref":"#/definitions/container.interval.selector.geofence"},{"$ref":"#/definitions/container.interval.selector.calculator"},{"$ref":"#/definitions/container.interval.selector.inactive"}],"x-key-property":"type"},"calc.interval.selectors":{"description":"[Intervals selectors](https://flespi.com/kb/analytics-reports-and-events-engine#interval-selectors) are used to split device messages into intervals based on user-defined criteria.\nResulting intervals will have begin, end times, and duration. It is possible to have intervals that consist of one message only, i.e. with zero duration.\n\nEach interval selector type has its own internal logic in the configuration, determines the state of each analyzed message sequentially, and assigns each message one of the following:\n* ON — interval can continue\n* ON_NEW — interval should restart\n* OFF — interval should stop\n* UNKNOWN — unable to calculate\n\nSo, to detect one interval it is enough to have at least one message marked ON or ON_NEW.\n\nIf multiple interval selectors are specified, they will be merged with AND logic, i.e. only ranges where all specified interval selectors are active will be present in the final intervals\n","items":{"$ref":"#/definitions/calc.interval.selector"},"maxItems":3,"minItems":1,"type":"array"},"changelog.get":{"properties":{"count":{"default":10000000,"description":"limit number of posts to be returned","format":"uint32","maximum":10000000,"minimum":1,"type":"integer"},"fields":{"description":"CSV-formatted list of post fields to be returned","maxLength":4096,"type":"string"},"filter":{"description":"optional filter expression to return only matching posts","maxLength":1024,"type":"string","x-view-type":"expression"},"from":{"description":"start moment's UNIX timestamp, use 0 to ignore left bound","minimum":0,"type":"number","x-view-type":"datetime"},"reverse":{"default":false,"description":"use true to list posts from newest to oldest","type":"boolean"},"to":{"description":"end moment's UNIX timestamp, use 0 to ignore right bound","minimum":0,"type":"number","x-view-type":"datetime"}},"type":"object"},"changelog.post":{"properties":{"author":{"description":"display name of the post author on the forum","type":"string"},"name":{"description":"name of the changelog the post belongs to","type":"string"},"text":{"description":"post text in markdown format","format":"textarea","type":"string"},"timestamp":{"description":"post publication UNIX timestamp","type":"number","x-view-type":"datetime"},"title":{"description":"changelog topic title","type":"string"},"url":{"description":"direct link to the post on the forum","type":"string"}},"type":"object"},"changelog.posts":{"properties":{"result":{"description":"changelog posts sorted by publication time","items":{"$ref":"#/definitions/changelog.post"},"type":"array"}},"type":"object"},"connector":{"description":"connector information","properties":{"agents_count":{"description":"Number of agents the connector is assigned to.","readOnly":true,"type":"integer"},"blocked":{"$ref":"#/definitions/item.blocked"},"cid":{"$ref":"#/definitions/item.cid"},"configuration":{"$ref":"#/definitions/connector.configuration"},"created":{"$ref":"#/definitions/item.btime"},"enabled":{"$ref":"#/definitions/item.enabled"},"id":{"$ref":"#/definitions/item.id"},"item_schema":{"$ref":"#/definitions/connector.item_schema"},"metadata":{"$ref":"#/definitions/metadata"},"name":{"$ref":"#/definitions/item.name"},"type_id":{"$ref":"#/definitions/connector.type_id"}},"type":"object"},"connector-type":{"description":"connector type information","properties":{"description":{"description":"connector type description","type":"string"},"id":{"$ref":"#/definitions/item.id"},"name":{"description":"connector type name","type":"string"},"operations":{"description":"public operations of the connector keyed by the operation type","type":"object"},"schema":{"description":"JSON schema for the connector configuration field","type":"object"}},"type":"object"},"connector-types.result":{"properties":{"errors":{"$ref":"#/definitions/errors"},"result":{"description":"Connector types collection.","items":{"$ref":"#/definitions/connector-type"},"type":"array"}},"type":"object"},"connector.configuration":{"additionalProperties":true,"description":"Connector configuration according to the connector type. Each connector type defines own schema for configuration field, you may retrieve it with [GET /ai/connector-types/all](/docs/#/ai/connector-types) API call.","maxProperties":100,"type":"object","x-view-schema":"connector_configuration"},"connector.item_schema":{"additionalProperties":true,"description":"JSON schema of the binding fields of an agent assignment, generated from the operations map of the connector type. Omitted when the type declares no operations.","readOnly":true,"type":"object"},"connector.post":{"properties":{"configuration":{"$ref":"#/definitions/connector.configuration"},"enabled":{"$ref":"#/definitions/item.enabled-default"},"metadata":{"$ref":"#/definitions/metadata"},"name":{"$ref":"#/definitions/item.name"},"type_id":{"$ref":"#/definitions/connector.type_id"}},"required":["name","type_id"],"title":"Connector","type":"object","x-view-order":["name","type_id","configuration","enabled","metadata"]},"connector.type_id":{"description":"Connector type id. You may retrieve available connector types with [GET /ai/connector-types/all](/docs/#/ai/connector-types) API call. Cannot be changed once the connector is created.","format":"uint32","minimum":1,"type":"integer","x-view-dict":"connector_types","x-view-selector":"connector-types"},"connectors.post":{"items":{"$ref":"#/definitions/connector.post"},"maxItems":128,"minItems":1,"title":"Connectors array","type":"array"},"connectors.put":{"properties":{"configuration":{"$ref":"#/definitions/connector.configuration"},"enabled":{"$ref":"#/definitions/item.enabled"},"metadata":{"$ref":"#/definitions/metadata"},"name":{"$ref":"#/definitions/item.name"}},"type":"object","x-view-order":["name","configuration","enabled","metadata"]},"connectors.result":{"properties":{"errors":{"$ref":"#/definitions/errors"},"result":{"description":"Connectors collection.","items":{"$ref":"#/definitions/connector"},"type":"array"}},"type":"object"},"consult-flespi-account.post":{"description":"Flespi account expert consultation","properties":{"question":{"description":"Question about your flespi account or the platform.\n","maxLength":4096,"minLength":1,"type":"string"}},"required":["question"],"type":"object"},"container.interval":{"additionalProperties":true,"description":"selected interval data","properties":{"begin":{"$ref":"#/definitions/container.interval.begin"},"duration":{"$ref":"#/definitions/container.interval.duration"},"end":{"$ref":"#/definitions/container.interval.end"}},"type":"object"},"container.interval.begin":{"description":"interval begin time, UNIX timestamp","minimum":1,"type":"number","x-view-type":"datetime"},"container.interval.counter":{"anyOf":[{"$ref":"#/definitions/container.interval.counter.expression"},{"$ref":"#/definitions/container.interval.counter.dataset"},{"$ref":"#/definitions/container.interval.counter.route"},{"$ref":"#/definitions/container.interval.counter.datetime"},{"$ref":"#/definitions/container.interval.counter.parameter"},{"$ref":"#/definitions/container.interval.counter.message"},{"$ref":"#/definitions/container.interval.counter.interval"},{"$ref":"#/definitions/container.interval.counter.active"},{"$ref":"#/definitions/container.interval.counter.geofence"},{"$ref":"#/definitions/container.interval.counter.variable"},{"$ref":"#/definitions/container.interval.counter.specified"},{"$ref":"#/definitions/container.interval.counter.accumulator"}],"x-key-property":"type"},"container.interval.counter.accumulator":{"description":"Accumulate value of another counter across multiple intervals.\n\nUse to compute aggregate metrics like total mileage.\n","properties":{"counter":{"description":"Counter name which numerical value to accumulate.\n","maxLength":128,"minLength":1,"type":"string"},"name":{"$ref":"#/definitions/container.interval.counter.name"},"reset_expression":{"description":"[Expression](https://flespi.com/kb/expressions) over interval counters that can be used to specify reset condition for accumulated value, e.g. when to start value accumulation again from scratch.\nNon-zero expression evaluation result means condition to be reset. For example you may specify: \"duration>3600\" to continiously accumulate value only for short intervals, that are less than 1 hour.\nprevious(\"counter_name\") function, if used in expression will return the value of counter_name counter from previously calculated and stored interval.\n","format":"expression-complex","maxLength":1024,"minLength":1,"type":"string","x-view-type":"expression"},"reset_interval":{"description":"Defines interval, upon which accumulated value will be automatically reset to zero","enum":["hour","day","week_monday","week_sunday","month","year"],"type":"string","x-view-enum-labels":["Hour","Day","Week (from Monday)","Week (from Sunday)","Month","Year"]},"type":{"const":"accumulator","default":"accumulator","description":"Accumulate value of another counter across multiple intervals.\n\nUse to compute aggregate metrics like total mileage.\n","readOnly":true,"type":"string"}},"required":["type","name","counter"],"title":"Accumulator","type":"object","x-view-order":["type","name","counter","reset_interval","reset_expression"],"x-view-shrink-field":"name"},"container.interval.counter.active":{"description":"Return true/false based on whether the interval is currently active/inactive.\n\nUse to detect unfinished (e.g. still is running) intervals.\n","properties":{"name":{"$ref":"#/definitions/container.interval.counter.name"},"type":{"const":"active","default":"active","description":"Return true/false based on whether the interval is currently active/inactive.\n\nUse to detect unfinished (e.g. still is running) intervals.\n","readOnly":true,"type":"string"}},"required":["type","name"],"title":"Active","type":"object","x-view-order":["type","name"],"x-view-shrink-field":"name"},"container.interval.counter.calculator":{"description":"Put intervals generated by another calculator into this calculator either as array(all or aggregated by some field) or object (first, last or aggregated).\nUse to intersect data from multiple calculators.","properties":{"allow_finish_after":{"description":"when true, may include intervals that started before our 'end' but finished later","type":"boolean"},"allow_start_before":{"description":"when true, may include intervals that started before our 'begin' but finished later","type":"boolean"},"calc_id":{"description":"Calculator ID which intervals to add","minimum":1,"type":"integer","x-flespi-acl":"gw/calcs","x-view-selector":"calcs"},"fields":{"description":"Specify which fields to copy from referenced calculator intervals.\nFor example to limit the size of counter JSON you may configure to include just 'id', 'begin' and 'duration' fields.\n","items":{"anyOf":[{"description":"Use field name from referenced calculator's interval as is","maxLength":64,"minLength":1,"pattern":"^[\\w:!%$.-]([\\w:!%$. -]*[\\w:!%$.-])?$","title":"Interval field","type":"string"},{"description":"Compute new field using expression over referenced calculator's interval fields and selected aggregate method\n\nIf expression is not specified the value of field from referenced interval JSON will be taken directly.\n","properties":{"aggregate":{"default":"first","description":"Aggregation method, valid only when counter method set to 'aggregate' or 'aggregate_by_field':\n - first - will be used the first calculated value\n - last - will be used the last calculated value\n - summary - will be used summation of all calculated values\n - minimum - will be used minimum calculated value (for numbers only)\n - maximum - will be used maximum calculated value (for numbers only)\n\n If 'aggregate_by_field' method is used aggregation method is not applicable to the first field, which is automatically used for grouping intervals\n","enum":["first","last","summary","minimum","maximum"],"type":"string"},"expression":{"description":"[Expression](https://flespi.com/kb/expressions) for calculating field value for the referenced interval.\n\nIf the expression value can not be calculated for the field it will generate null.\n\nIf expression is not specified for the field the value from referenced interval JSON will be taken directly.\n","format":"expression-complex","maxLength":256,"minLength":1,"type":"string","x-view-type":"expression"},"name":{"description":"field name, will be used as key in generated interval JSON","maxLength":64,"minLength":1,"pattern":"^[\\w:!%$.-]([\\w:!%$. -]*[\\w:!%$.-])?$","type":"string"}},"required":["name"],"title":"Computed field","type":"object","x-view-order":["name","expression","aggregate"],"x-view-shrink-field":"name"}]},"maxItems":24,"minItems":1,"type":"array"},"lookup_time_after":{"description":"specify how many seconds to look forward after interval end to search for intervals","maximum":864000,"minimum":0,"type":"integer"},"lookup_time_before":{"description":"specify how many seconds to look back before interval begin to search for intervals","maximum":864000,"minimum":0,"type":"integer"},"method":{"default":"each","description":"Method for selecting interval(s) from referenced calculator:\n - first - will be used the first suitable interval\n - last - will be used the last suitable interval\n - each - all suitable intervals values will be presented as array\n - aggregate - aggregate intervals into single, for this method you should specify fields\n - aggregate_by_field - group intervals based on the first field, and aggregate them into single value, the first field value will be used for grouping\n","enum":["first","last","each","aggregate","aggregate_by_field"],"type":"string"},"name":{"$ref":"#/definitions/container.interval.counter.name"},"type":{"const":"calc","default":"calc","description":"Put intervals generated by another calculator into this calculator either as array(all or aggregated by some field) or object (first, last or aggregated).\nUse to intersect data from multiple calculators.","readOnly":true,"type":"string"},"validate_interval":{"description":"Optional expression to validate intervals. If specified only those intervals from referenced calculator that conforms to the expression will be added.\nYou use flespi [expressions](https://flespi.com/kb/expressions) and reference interval counter fields as parameters inside it.\n","format":"expression-complex","maxLength":1024,"type":"string","x-view-type":"expression"}},"required":["type","name","calc_id"],"title":"Calculator","type":"object","x-view-order":["type","name","calc_id","method","validate_interval","allow_start_before","lookup_time_before","allow_finish_after","lookup_time_after","fields","aggregate"],"x-view-shrink-field":"name"},"container.interval.counter.dataset":{"description":"For each message generate a JSON object and return an array of generated points.\n\nUse to collect a set of specific data points for each interval, e.g. to plot them on a diagram.\n\nWhen there is a need to copy message parameters into the interval without any conversion or renaming it is suggested to use 'message' counter with method='each' instead.\nAlso take a look at counter of type='parameter' which can be also suitable instead of dataset.\n","properties":{"allow_unknown":{"description":"when true, if some field is not possible to calculate (e.g. parameter is missing) pass null instead","type":"boolean"},"fields":{"description":"values to be precalcuated for each message","items":{"properties":{"name":{"description":"field name, will be used as key in generated JSON for each message","maxLength":64,"minLength":1,"pattern":"^[\\w:!%$.-]([\\w:!%$. -]*[\\w:!%$.-])?$","type":"string"},"value":{"description":"[Expression](https://flespi.com/kb/expressions) for calculating field value for the message referencing values of its parameters, e.g.: (param1+param2)/(param3-param4)\n","format":"expression-complex","maxLength":256,"minLength":1,"type":"string","x-view-type":"expression"}},"required":["name","value"],"title":"Field","type":"object"},"maxItems":20,"minItems":1,"type":"array"},"name":{"$ref":"#/definitions/container.interval.counter.name"},"type":{"const":"dataset","default":"dataset","description":"For each message generate a JSON object and return an array of generated points.\n\nUse to collect a set of specific data points for each interval, e.g. to plot them on a diagram.\n\nWhen there is a need to copy message parameters into the interval without any conversion or renaming it is suggested to use 'message' counter with method='each' instead.\nAlso take a look at counter of type='parameter' which can be also suitable instead of dataset.\n","readOnly":true,"type":"string"},"validate_message":{"$ref":"#/definitions/container.interval.validate_message"}},"required":["type","name","fields"],"title":"Dataset","type":"object","x-view-order":["type","name","fields","allow_unknown","validate_message"],"x-view-shrink-field":"name"},"container.interval.counter.datetime":{"description":"Print the user-formatted begin or end time according to specified timezone into the interval.\n\nUse to add interval begin/end time as string in user's timezone.\n","properties":{"format":{"default":"%c","description":"Timestamp format, POSIX way, check strftime function for the format definition","maxLength":256,"minLength":2,"type":"string"},"interval":{"default":"begin","description":"Timestamp source","enum":["begin","end"],"type":"string","x-view-enum-labels":["Interval begin","Interval end"]},"name":{"$ref":"#/definitions/container.interval.counter.name"},"type":{"const":"datetime","default":"datetime","description":"Print the user-formatted begin or end time according to specified timezone into the interval.\n\nUse to add interval begin/end time as string in user's timezone.\n","readOnly":true,"type":"string"},"validate_message":{"$ref":"#/definitions/container.interval.validate_message"}},"required":["type","name"],"title":"Datetime","type":"object","x-view-order":["type","name","interval","format","validate_message"],"x-view-shrink-field":"name"},"container.interval.counter.expression":{"description":"Calculate a value based on device message parameter values.\nEvaluates an expression using device message parameters and add its first, last, average, minimum or maximum calculated value to the interval.\n\nThis is the most popular type of interval counter that is used to calculate almost everything which can be extracted from device messages within the selected interval.\nUse to compute various metrics within interval like mileage, engine hours, duration of some event and so on.\nAlso used to determine first/last value of specific message parameters within interval.\n","properties":{"expression":{"description":"[Expression](https://flespi.com/kb/expressions) for calculating counter value for the message referencing values of its parameters, e.g.: (param1+param2)/(param3-param4)\n","format":"expression-complex","maxLength":1024,"minLength":1,"type":"string","x-view-type":"expression"},"method":{"default":"first","description":"Method for combining each message's value on interval together:\n - first - will be used first calculated value\n - last - will be used last calculated value\n - minimum - will be used the minimum calculated value\n - maximum - will be used the maximum calculated value\n - summary - will be used summation of all calculated values\n - average - average value among calculated\n - difference - the difference between each next and current calculated values, in the counter summary of such differences will be stored\n - duration - summary of duration from the current message till the next, for each case when boolean expression evaluates to non-zero\n","enum":["first","last","average","minimum","maximum","summary","difference","duration"],"type":"string"},"name":{"$ref":"#/definitions/container.interval.counter.name"},"type":{"const":"expression","default":"expression","description":"Calculate a value based on device message parameter values.\nEvaluates an expression using device message parameters and add its first, last, average, minimum or maximum calculated value to the interval.\n\nThis is the most popular type of interval counter that is used to calculate almost everything which can be extracted from device messages within the selected interval.\nUse to compute various metrics within interval like mileage, engine hours, duration of some event and so on.\nAlso used to determine first/last value of specific message parameters within interval.\n","readOnly":true,"type":"string"},"validate_message":{"$ref":"#/definitions/container.interval.validate_message"}},"required":["type","name","expression"],"title":"Expression","type":"object","x-view-order":["type","name","expression","method","validate_message"],"x-view-shrink-field":"name"},"container.interval.counter.geofence":{"description":"Store the name of the geofence that was triggered in the interval selector of type 'geofence'.\n\nUse only with interval selector of type 'geofence'. In all other cases it will report null.\n","properties":{"name":{"$ref":"#/definitions/container.interval.counter.name"},"type":{"const":"geofence","default":"geofence","description":"Store the name of the geofence that was triggered in the interval selector of type 'geofence'.\n\nUse only with interval selector of type 'geofence'. In all other cases it will report null.\n","readOnly":true,"type":"string"}},"required":["type","name"],"title":"Geofence","type":"object","x-view-order":["type","name"],"x-view-shrink-field":"name"},"container.interval.counter.interval":{"description":"Calculate result of expression that references already calculated interval parameters (that are defined as counter before this counter).\n\nUse to compute average/max/min values for the interval or perform any other combination of interval counter values into a new one.\n\nIn expression you access interval parameters by using the names of previously defined counters.\nThe availability of parameters in the interval message depends on the order of defined counters as it may reference only previously defined counter names.\n","properties":{"expression":{"description":"[Expression](https://flespi.com/kb/expressions) for calculating counter value for the interval referencing values of its counters, e.g.: (counter1+counter2)/duration\n","format":"expression-complex","maxLength":1024,"minLength":1,"type":"string","x-view-type":"expression"},"name":{"$ref":"#/definitions/container.interval.counter.name"},"type":{"const":"interval","default":"interval","description":"Calculate result of expression that references already calculated current interval parameters (that are defined as counters and located before this one in the counters array) or counter values from previously calculated interval (accessible with previous(\"counter_name\") function).\n\nUse to compute average/max/min values for the interval or perform any other combination of interval counter values into a new one.\n\nIn expression you access interval parameters by using the names of previously defined counters.\nThe availability of parameters in the interval message depends on the order of defined counters as it may reference only previously defined counter names.\n","readOnly":true,"type":"string"}},"required":["type","name","expression"],"title":"Interval","type":"object","x-view-order":["type","name","expression"],"x-view-shrink-field":"name"},"container.interval.counter.message":{"description":"Copy part or full message JSON into the interval according to specified method (first, last, each, aggregate, aggregate_by_field).\n\nUse to include raw, filtered or aggregated message data into the interval.\n\nAlso is used to copy into interval the values of first or last message parameters in simplfied form.\n\nAlso is used to find an extremum on the interval, for a example add to the interval a message when the speed was maximum.\n\nAlso is used to calculate aggregated value from messages by some field, for example to enumerate all encountered BLE beacons and add their last position.\n","properties":{"extremum":{"description":"Select message(s) according to selected extremum calculated from the specified expression","properties":{"expression":{"description":"[Expression](https://flespi.com/kb/expressions) for calculating extremum value for the message referencing values of its parameters, e.g.: (param1+param2)/(param3-param4)\n","format":"expression-complex","maxLength":1024,"minLength":1,"type":"string","x-view-type":"expression"},"type":{"default":"minimum","description":"Type of the extremum of calculated expression to select correct message(s)","enum":["minimum","maximum"],"type":"string"}},"required":["type","expression"],"type":"object","x-view-order":["type","expression"]},"fields":{"description":"Fields to copy from the message into JSON object under counter. If not specified all message fields will be copied.\n","items":{"anyOf":[{"description":"Use message parameter name as is","maxLength":256,"minLength":1,"pattern":"^[\\w:!%$.-]([\\w:!%$. -]*[\\w:!%$.-])?$","title":"Message field","type":"string"},{"description":"Compute new field using expression over message parameters and selected aggregate method\n\nIf expression is not specified the value of message parameter will be taken directly.\n","properties":{"aggregate":{"default":"first","description":"Aggregation method, valid only when counter method set to 'aggregate' or 'aggregate_by_field':\n - first - will be used the first calculated value\n - last - will be used the last calculated value\n - summary - will be used summation of all calculated values\n - minimum - will be used minimum calculated value (for numbers only)\n - maximum - will be used maximum calculated value (for numbers only)\n\n If 'aggregate_by_field' method is used aggregation method is not applicable to the first field, which is automatically used for grouping messages\n","enum":["first","last","summary","minimum","maximum"],"type":"string"},"expression":{"description":"[Expression](https://flespi.com/kb/expressions) for calculating field value for counter JSON output.\n\nIf the expression value can not be calculated for the field it will generate null.\n\nIf expression is not specified for the field the value from message parameter with the same name as field will be taken directly.\n","format":"expression-complex","maxLength":256,"minLength":1,"type":"string","x-view-type":"expression"},"name":{"description":"field name, will be used as key in the counter JSON output","maxLength":64,"minLength":1,"pattern":"^[\\w:!%$.-]([\\w:!%$. -]*[\\w:!%$.-])?$","type":"string"}},"required":["name"],"title":"Computed field","type":"object","x-view-order":["name","expression","aggregate"],"x-view-shrink-field":"name"}]},"maxItems":20,"minItems":1,"type":"array"},"method":{"default":"first","description":"Method for selecting message which will be copied into parameter's value:\n - first - will be used the first suitable message\n - last - will be used the last suitable message\n - each - all suitable messages values will be presented as array\n - aggregate - aggregate messages into single, for this method you should specify fields\n - aggregate_by_field - group messages based on the first field, and aggregate them into single value, the first field value will be used for grouping\n","enum":["first","last","each","aggregate","aggregate_by_field"],"type":"string"},"name":{"$ref":"#/definitions/container.interval.counter.name"},"type":{"const":"message","default":"message","description":"Copy part or full message JSON into the interval according to specified method (first, last, each, aggregate, aggregate_by_field).\n\nUse to include raw, filtered or aggregated message data into the interval.\n\nAlso is used to copy into interval the values of first or last message parameters in simplfied form.\n\nAlso is used to find an extremum on the interval, for a example add to the interval a message when the speed was maximum.\n\nAlso is used to calculate aggregated value from messages by some field, for example to enumerate all encountered BLE beacons and add their last position.\n","readOnly":true,"type":"string"},"validate_message":{"$ref":"#/definitions/container.interval.validate_message"}},"required":["type","name"],"title":"Message","type":"object","x-view-order":["type","name","method","extremum","fields","validate_message"],"x-view-shrink-field":"name"},"container.interval.counter.name":{"description":"counter name, will be used as key in generated interval JSON","maxLength":64,"minLength":1,"pattern":"^[\\w_\\.\\-]+$","type":"string"},"container.interval.counter.parameter":{"description":"Add parameter value(-es) from the message into the interval (e.g. first, last, each or each distinct encountered).\n\nUse to include specific message parameters into the interval JSON.\n\nThis counter usually is used for simple cases like copy device.id or ident to the interval JSON.\nIt is also suitable for more complex cases when you need to enumerate all distinct parameter values encountered in messages - for example enumerate visited geofences detected by plugin, failed DTC codes or list all encountered BLE beacons.\n\n\nFor more complex cases, when you need to add multiple message parameters or somehow convert their value using expression take a look at 'expression' and 'message' interval counters instead.\n","properties":{"method":{"default":"first","description":"Method for generating counter value:\n - first - will be used parameter value from the first suitable message\n - last - will be used parameter value from the last suitable message\n - each - parameter value form all suitable messages will be presented as an array\n - distinct - distinct parameter values gathered from all suitable messages will be presented as array. If parameter value is an array by itself its unique elements will be extracted.\n","enum":["first","last","each","distinct"],"type":"string"},"name":{"$ref":"#/definitions/container.interval.counter.name"},"parameter":{"description":"Original message parameter name which to add to the interval, if not specified counter name will be used.\n\nFor distinct method the counter will store in the interval JSON all unique values of this parameter encountered in messages.\nWhen the parameter value is JSON array all unique elements inside array will be enumerated.\nThis can be used for all cases like enumerating DTC codes from \"can.dtc\" parameter, visited geofences from \"plugin.geofence.name\" parameter and even includes all BLE beacons tracked with \"ble.beacons\" parameter.\n\nYou can not use anything except message parameter name in this field. If you want to convert parameter value using some expression or calculate a value based on multiple parameters consider using 'expression' or 'message' type of interval counter instead.\n","maxLength":128,"type":"string"},"type":{"const":"parameter","default":"parameter","description":"Add parameter value(-es) from the message into the interval (e.g. first, last, each or each distinct encountered).\n\nUse to include specific message parameters into the interval JSON.\n\nThis counter usually is used for simple cases like copy device.id or ident to the interval JSON.\nIt is also suitable for more complex cases when you need to enumerate all distinct parameter values encountered in messages - for example enumerate visited geofences detected by plugin, failed DTC codes or list all encountered BLE beacons.\n\n\nFor more complex cases, when you need to add multiple message parameters or somehow convert their value using expression take a look at 'expression' and 'message' interval counters instead.\n","readOnly":true,"type":"string"},"validate_message":{"$ref":"#/definitions/container.interval.validate_message"}},"required":["type","name"],"title":"Parameter","type":"object","x-view-order":["type","name","parameter","method","validate_message"],"x-view-shrink-field":"name"},"container.interval.counter.route":{"description":"Dump position.latitude and position.longitude parameters for each message within the interval into [Google-encoded polyline algorithm](https://developers.google.com/maps/documentation/utilities/polylinealgorithm) format.\n\nUse to generate a compressed representation of the trip’s route.\n","properties":{"name":{"$ref":"#/definitions/container.interval.counter.name"},"type":{"const":"route","default":"route","description":"Dump position.latitude and position.longitude parameters for each message within the interval into [Google-encoded polyline algorithm](https://developers.google.com/maps/documentation/utilities/polylinealgorithm) format.\n\nUse to generate a compressed representation of the trip’s route.\n","readOnly":true,"type":"string"},"validate_message":{"$ref":"#/definitions/container.interval.validate_message"}},"required":["type","name"],"title":"Route","type":"object","x-view-order":["type","name","validate_message"],"x-view-shrink-field":"name"},"container.interval.counter.specified":{"description":"Save info into the interval field under specified name and value.\n\nUse to tag calculators for easier filtering later on.\n","properties":{"name":{"$ref":"#/definitions/container.interval.counter.name"},"type":{"const":"specified","default":"specified","description":"Save info into the interval field under specified name and value.\n\nUse to tag calculators for easier filtering later on.\n","readOnly":true,"type":"string"},"value":{"anyOf":[{"maxLength":256,"minLength":1,"title":"string","type":"string"},{"title":"number","type":"number"},{"title":"boolean","type":"boolean"}]}},"required":["type","name","value"],"title":"Specified","type":"object","x-view-order":["type","name","value"],"x-view-shrink-field":"name"},"container.interval.counter.variable":{"description":"Calculate value according to expression and make it available for use in other counters’ expressions.\n\nUse to store and maintain state during counters calculation.\n\nAccess to claculated value by this counter is available in other counters through the use of variable(\"counter-name\") function.\nNo actual value will be stored in the interval JSON.\n","properties":{"expression":{"description":"[Expression](https://flespi.com/kb/expressions) for calculating variable value for the message referencing values of its parameters, e.g.: (param1+param2)/(param3-param4)\n","format":"expression-complex","maxLength":1024,"minLength":1,"type":"string","x-view-type":"expression"},"name":{"$ref":"#/definitions/container.interval.counter.name"},"type":{"const":"variable","default":"variable","description":"Calculate value according to expression and make it available for use in other counters’ expressions.\n\nUse to store and maintain state during counters calculation.\n\nAccess to claculated value by this counter is available in other counters through the use of variable(\"counter-name\") function.\nNo actual value will be stored in the interval JSON.\n","readOnly":true,"type":"string"},"validate_message":{"$ref":"#/definitions/container.interval.validate_message"}},"required":["type","name","expression"],"title":"Variable (virtual)","type":"object","x-view-order":["type","name","expression","method","validate_message"],"x-view-shrink-field":"name"},"container.interval.counters":{"description":"[Intervals counters](https://flespi.com/kb/analytics-reports-and-events-engine#interval-counters), define how to calculate messsages inside each interval.\n","items":{"$ref":"#/definitions/container.interval.counter"},"maxItems":50,"type":"array"},"container.interval.duration":{"description":"interval duration in seconds","type":"number"},"container.interval.end":{"description":"interval end time","minimum":1,"type":"number","x-view-type":"datetime"},"container.interval.geofence.coordinate":{"properties":{"lat":{"description":"Latitude in degrees, between -90 and +90 inclusive","maximum":90,"minimum":-90,"type":"number"},"lon":{"description":"Longitude in degrees, between -180 and +180 inclusive","maximum":180,"minimum":-180,"type":"number"}},"required":["lat","lon"],"title":"Coordinate","type":"object"},"container.interval.geofence.name":{"description":"geofence name, can be optionally ava in 'geofence' counter","maxLength":128,"type":"string"},"container.interval.selector":{"anyOf":[{"$ref":"#/definitions/container.interval.selector.expression"},{"$ref":"#/definitions/container.interval.selector.datetime"},{"$ref":"#/definitions/container.interval.selector.geofence"},{"$ref":"#/definitions/container.interval.selector.inactive"}],"x-key-property":"type"},"container.interval.selector.calculator":{"description":"Intervals are detected based on another calculator intervals.\nThis type of selector can be used only in calculators and not available in on-demand intervals calculation via REST API.\n","properties":{"calc_id":{"description":"Calculator ID which intervals will be used as a reference for this selector","minimum":1,"type":"integer","x-flespi-acl":"gw/calcs","x-view-selector":"calcs"},"invert":{"$ref":"#/definitions/container.interval.selector.invert"},"max_active":{"$ref":"#/definitions/container.interval.selector.max_active"},"max_inactive":{"$ref":"#/definitions/container.interval.selector.max_inactive"},"max_messages_time_diff":{"$ref":"#/definitions/container.interval.selector.max_messages_time_diff"},"min_active":{"$ref":"#/definitions/container.interval.selector.min_active"},"min_duration":{"$ref":"#/definitions/container.interval.selector.min_duration"},"type":{"const":"calc","default":"calc","description":"Intervals are detected based on another calculator intervals.\nThis type of selector can be used only in calculators and not available in on-demand intervals calculation via REST API.\n","readOnly":true,"type":"string"},"validate_interval":{"description":"Optional [expression](https://flespi.com/kb/expressions) to validate intervals that will be used for referencing this selector.","format":"expression-telematics","maxLength":1024,"type":"string"}},"required":["type","calc_id"],"title":"Calculator","type":"object","x-view-order":["type","calc_id","min_active","min_duration","max_inactive","max_messages_time_diff","max_active","invert","validate_interval"],"x-view-shrink-field":"name"},"container.interval.selector.datetime":{"description":"Interval selection with time & date change according to selected or default timezone. Can be used to split messages on intervals per each day or month.","properties":{"max_messages_time_diff":{"$ref":"#/definitions/container.interval.selector.max_messages_time_diff"},"merge_message_after":{"$ref":"#/definitions/container.interval.selector.merge_message_after"},"merge_message_before":{"$ref":"#/definitions/container.interval.selector.merge_message_before"},"name":{"$ref":"#/definitions/container.interval.selector.name"},"split":{"default":"day","description":"Defines criteria, upon which interval will be automatically splitted","enum":["hour","day","week_monday","week_sunday","month","year"],"type":"string","x-view-enum-labels":["Hour","Day","Week (from Monday)","Week (from Sunday)","Month","Year"]},"type":{"const":"datetime","default":"datetime","description":"Interval selection with time & date change according to selected or default timezone. Can be used to split messages on intervals per each day or month.","readOnly":true,"type":"string"},"validate_message":{"$ref":"#/definitions/container.interval.validate_message"}},"required":["type"],"title":"Date or Time","type":"object","x-view-order":["type","split","name","max_messages_time_diff","merge_message_before","merge_message_after","validate_message"],"x-view-shrink-field":"name"},"container.interval.selector.expression":{"description":"Interval selection via non-zero expression that references message properties","properties":{"expression":{"description":"[Expression](https://flespi.com/kb/expressions) that defines is given message belong to the interval or not.\nIn expression you may reference values of message parameters, e.g.: (param1+param2)>=1 | (param3-param4)!=0\n","format":"expression-complex","maxLength":1024,"minLength":1,"type":"string","x-view-type":"expression"},"invert":{"$ref":"#/definitions/container.interval.selector.invert"},"max_active":{"$ref":"#/definitions/container.interval.selector.max_active"},"max_inactive":{"$ref":"#/definitions/container.interval.selector.max_inactive"},"max_messages_time_diff":{"$ref":"#/definitions/container.interval.selector.max_messages_time_diff"},"merge_message_after":{"$ref":"#/definitions/container.interval.selector.merge_message_after"},"merge_message_before":{"$ref":"#/definitions/container.interval.selector.merge_message_before"},"merge_unknown":{"$ref":"#/definitions/container.interval.selector.merge_unknown"},"method":{"default":"boolean","description":"Defines the way how expression result will be evaluated for the interval.\n- boolean method expects non-zero value to activate/continue interval and zero to stop it\n- change method will setup new interval each time expression result is different from previous\n","enum":["boolean","change"],"type":"string"},"min_active":{"$ref":"#/definitions/container.interval.selector.min_active"},"min_duration":{"$ref":"#/definitions/container.interval.selector.min_duration"},"name":{"$ref":"#/definitions/container.interval.selector.name"},"type":{"const":"expression","default":"expression","description":"Interval selection via non-zero expression that references message properties","readOnly":true,"type":"string"},"validate_message":{"$ref":"#/definitions/container.interval.validate_message"}},"required":["type","expression"],"title":"Expression","type":"object","x-view-order":["type","expression","method","name","min_active","min_duration","max_inactive","max_messages_time_diff","max_active","merge_message_before","merge_message_after","merge_unknown","invert","validate_message"],"x-view-shrink-field":"name"},"container.interval.selector.geofence":{"description":"Create intervals based on the geofence inside/outside status.\n\nBy default it will return ON status for the message when it is inside of assigned or configured geofences. When geofence is changed it will return ON_NEW status.\n\nTo create intervals when device is outside of assigned or configured geofences use invert=true option which will return ON status for each message outside of assigned or configured geofences.\n\nFor more precise control of geofences status you may use interval selector of type expression and within expression test for geofence availability: \"geofence() != null\" or simple expression=\"geofence()\" (returns the name of assigned geofence of null) and method=\"change\".\n\nWhich geofences to use is determined by 'geofences' option.\nIf you leave it unspecified in the selector configuration, all geofences assigned to calculator will be used automatically.\nIf you will explicitly specify geofences in selector configuration only these geofences will be controlled.\n","properties":{"geofences":{"description":"Explicit configuration of geofences for entrance/exit detection.\n\nWhen geofences configuration provided explicitly with this parameter the selector will use only their configuration ignoring any geofence entity that is linked to the device or calculator.\n\nTo avoid any misinterpretation and unlock extra functionality we recommend to avoid explicit geofences configuration (leave 'geofences' unconfigured in the interval selector) and only use geofences that are linked to the device or calculator.\n","items":{"anyOf":[{"$ref":"#/definitions/geoset.circle"},{"$ref":"#/definitions/geoset.polygon"},{"$ref":"#/definitions/geoset.corridor"}],"x-key-property":"type"},"maxItems":64,"minItems":1,"type":"array"},"invert":{"$ref":"#/definitions/container.interval.selector.invert"},"max_active":{"$ref":"#/definitions/container.interval.selector.max_active"},"max_inactive":{"$ref":"#/definitions/container.interval.selector.max_inactive"},"max_messages_time_diff":{"$ref":"#/definitions/container.interval.selector.max_messages_time_diff"},"merge_message_after":{"$ref":"#/definitions/container.interval.selector.merge_message_after"},"merge_message_before":{"$ref":"#/definitions/container.interval.selector.merge_message_before"},"merge_unknown":{"$ref":"#/definitions/container.interval.selector.merge_unknown"},"min_active":{"$ref":"#/definitions/container.interval.selector.min_active"},"min_duration":{"$ref":"#/definitions/container.interval.selector.min_duration"},"name":{"$ref":"#/definitions/container.interval.selector.name"},"type":{"const":"geofence","default":"geofence","description":"Create intervals based on the geofence inside/outside status.\n\nBy default it will return ON status for the message when it is inside of assigned or configured geofences. When geofence is changed it will return ON_NEW status.\n\nTo create intervals when device is outside of assigned or configured geofences use invert=true option which will return ON status for each message outside of assigned or configured geofences.\n\nFor more precise control of geofences status you may use interval selector of type expression and within expression test for geofence availability: \"geofence() != null\" or simple expression=\"geofence()\" (returns the name of assigned geofence of null) and method=\"change\".\n\nWhich geofences to use is determined by 'geofences' option.\nIf you leave it unspecified in the selector configuration, all geofences assigned to calculator will be used automatically.\nIf you will explicitly specify geofences in selector configuration only these geofences will be controlled.\n","readOnly":true,"type":"string"},"validate_message":{"$ref":"#/definitions/container.interval.validate_message"}},"required":["type"],"title":"Geofences","type":"object","x-view-order":["type","geofences","name","min_active","min_duration","max_inactive","max_messages_time_diff","max_active","merge_message_before","merge_message_after","merge_unknown","invert","validate_message"],"x-view-shrink-field":"name"},"container.interval.selector.inactive":{"description":"Interval selection based on the inactivity of telemetry data reception.\nWith this selector it is both possible to detect delays of telemetry data from device in realtime and analyze historical intervals when such delays occurred.\n","properties":{"delay_threshold":{"description":"Minimum latency in telemetry data retrieval to start interval, in seconds.\nTelemetry latency for each message can be calculated as (server.timestamp - timestamp).\nInterval will automatically start the from latest message below specified threshold and finish on the last message below threshold.\n","format":"uint32","maximum":315360000,"minimum":60,"type":"number"},"name":{"$ref":"#/definitions/container.interval.selector.name"},"type":{"const":"inactive","default":"inactive","description":"Interval selection based on the inactivity of telemetry data reception.\nWith this selector it is both possible to detect delays of telemetry data from device in realtime and analyze historical intervals when such delays occurred.\n","readOnly":true,"type":"string"}},"required":["type","delay_threshold"],"title":"Inactive","type":"object","x-view-order":["type","name","delay_threshold"],"x-view-shrink-field":"name"},"container.interval.selector.invert":{"description":"when true, evaluation of interval state for the message should be inverted, e.g. ON will become OFF. For example if you have a geofence selector and want to detect when a device leaves this geofence (in contrast to detecting when a device gets into the geofence), you want to enable the \"invert\" property.","type":"boolean"},"container.interval.selector.max_active":{"description":"if non-zero (in seconds), during sequential interval detection when the duration of a currently detected interval exceeds the specified value in seconds, the new interval will be started.","format":"uint32","maximum":864000,"type":"integer"},"container.interval.selector.max_inactive":{"description":"if non-zero (in seconds), inactive parts of intervals with duration shorter than the specified number of seconds will count towards the current interval and will be merged with the preceding and following active parts. Also, this property can timeout an active interval for the assigned device.","format":"uint32","maximum":864000,"type":"integer"},"container.interval.selector.max_messages_time_diff":{"description":"if non-zero, specifies a maximum timestamps difference between the two consecutive messages to include into the same interval, in seconds","format":"uint32","maximum":864000,"type":"integer"},"container.interval.selector.merge_message_after":{"description":"when true, the interval will be automatically extended by one message after with OFF/UNKNOWN state.","type":"boolean"},"container.interval.selector.merge_message_before":{"description":"when true, the interval will be automatically extended by one message earlier with OFF/UNKNOWN state.","type":"boolean"},"container.interval.selector.merge_unknown":{"description":"when true, if we have an active interval and the current message state is unknown, it will be appended to the active interval. The unknown state can appear in an expression type selector when a message does not contain a parameter specified in the expression or in a geofence type selector when there are no coordinates in the message.","type":"boolean"},"container.interval.selector.min_active":{"description":"if non-zero (in seconds), all intervals with duration in seconds less than specified will be skipped.","format":"uint32","maximum":86400,"type":"integer"},"container.interval.selector.min_duration":{"description":"minimum final(merged) duration for the generated interval, in seconds","format":"uint32","maximum":86400,"type":"integer"},"container.interval.selector.name":{"description":"custom description for interval selector","maxLength":256,"type":"string"},"container.interval.selectors":{"description":"[Intervals selectors](https://flespi.com/kb/analytics-reports-and-events-engine#interval-selectors), specify the way to extract intervals from messages.\n","items":{"$ref":"#/definitions/container.interval.selector"},"maxItems":3,"minItems":1,"type":"array"},"container.interval.timezone":{"default":"UTC","description":"Default timezone used in all date/time related operations in selectors and counters, optional","enum":["UTC","Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Atikokan","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Costa_Rica","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Fort_Nelson","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Inuvik","America/Iqaluit","America/Jamaica","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Chita","Asia/Choibalsan","Asia/Colombo","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Hebron","Asia/Ho_Chi_Minh","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kathmandu","Asia/Khandyga","Asia/Kolkata","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Riyadh","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ulaanbaatar","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yangon","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faroe","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Currie","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/Perth","Australia/Sydney","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Ulyanovsk","Europe/Uzhgorod","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Chuuk","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Pohnpei","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Wake","Pacific/Wallis"],"type":"string"},"container.interval.validate_interval":{"description":"[Expression](https://flespi.com/kb/expressions) for validating generated interval referencing values of its counters, e.g.: (counter1-counter2) > counter3.\nprevious(\"counter_name\") function, if used in expression will return the value of counter_name counter from previously calculated and stored interval.\n**Note: Do not use this field to filter intervals by duration (e.g., 'duration > X'). Instead, use the `min_active` and `min_duration` parameters in interval selectors.**\n","format":"expression-complex","maxLength":1024,"type":"string","x-view-type":"expression"},"container.interval.validate_message":{"description":"[Expression](https://flespi.com/kb/expressions) validating messages for selector/counter/calculator, e.g. value of 'position.valid == 1' will skip all messages where position.valid property is not defined or not 1(true)\n","format":"expression-complex","maxLength":1024,"type":"string","x-view-type":"expression"},"container.intervals.calculate":{"description":"intervals calculation configuration","properties":{"counters":{"$ref":"#/definitions/container.interval.counters"},"extend":{"$ref":"#/definitions/container.intervals.calculate.extend"},"from":{"$ref":"#/definitions/container.intervals.calculate.from"},"selectors":{"$ref":"#/definitions/container.interval.selectors"},"timezone":{"$ref":"#/definitions/container.interval.timezone"},"to":{"$ref":"#/definitions/container.intervals.calculate.to"},"validate_interval":{"$ref":"#/definitions/container.interval.validate_interval"},"validate_message":{"$ref":"#/definitions/container.interval.validate_message"}},"required":["selectors"],"title":"intervals configuration from REST parameters","type":"object","x-view-order":["from","to","extend","selectors","counters","timezone","validate_message","validate_interval"]},"container.intervals.calculate.extend":{"description":"if true, then interval will be extended up to one next message after 'to' and include it in its calculations, usually used together with merge_messages_after=true for interval selectors","type":"boolean"},"container.intervals.calculate.from":{"description":"UNIX timestamp of left time border for messages. Use 0 to ignore left bound.","minimum":0,"type":"number","x-view-type":"datetime"},"container.intervals.calculate.to":{"description":"UNIX timestamp of right time border for messages. Use 0 to ignore right bound.","minimum":0,"type":"number","x-view-type":"datetime"},"error":{"properties":{"code":{"description":"Error code.","type":"integer"},"id":{"$ref":"#/definitions/item.id"},"reason":{"description":"Error description.","type":"string"}},"type":"object"},"errors":{"description":"Errors occurred while processing the request.","items":{"$ref":"#/definitions/error"},"type":"array"},"errors.result":{"description":"Canonical flespi response envelope used for non-2xx responses (and also when a 200 response carries per-item errors). 'result' is empty when 'errors' is populated.","properties":{"errors":{"$ref":"#/definitions/errors"},"result":{"description":"Always empty on error-only responses.","items":{},"type":"array"}},"type":"object"},"generate-flespi-expression.post":{"description":"Flespi expression generation request","properties":{"question":{"description":"Question or task description for flespi expression generation.\n","maxLength":4096,"minLength":1,"type":"string","x-view-type":"textarea"}},"required":["question"],"type":"object"},"generate-pvm-code.post":{"description":"PVM code generation request","properties":{"task":{"description":"Task description for PVM code generation. Provide details including specification of input and output message.\n","maxLength":16384,"minLength":16,"type":"string","x-view-type":"textarea"}},"required":["task"],"type":"object"},"geoset.circle":{"description":"Circular region","properties":{"center":{"$ref":"#/definitions/container.interval.geofence.coordinate"},"name":{"$ref":"#/definitions/container.interval.geofence.name"},"radius":{"description":"Radius in kilometers","maximum":1000,"minimum":0.001,"type":"number"},"type":{"const":"circle","default":"circle","description":"Circle","readOnly":true,"type":"string"}},"required":["type","center","radius"],"title":"Circle","type":"object","x-view-order":["type","name","center","radius"],"x-view-shrink-field":"name","x-view-type":"geofence"},"geoset.corridor":{"description":"Corridor of certain width that consists from multiple sequentially connected points","properties":{"name":{"$ref":"#/definitions/container.interval.geofence.name"},"path":{"description":"Series of coordinates","items":{"$ref":"#/definitions/container.interval.geofence.coordinate"},"maxItems":1000,"minItems":2,"type":"array"},"type":{"const":"corridor","default":"corridor","description":"Corridor of certain width","readOnly":true,"type":"string"},"width":{"description":"Corridor width, maximum allowed distance till centerline between two neighbor points, in kilometers","maximum":1000,"minimum":0.001,"type":"number"}},"required":["type","path","width"],"title":"Corridor","type":"object","x-view-order":["type","name","width","path"],"x-view-shrink-field":"name","x-view-type":"geofence"},"geoset.polygon":{"description":"Area enclosed by a closed path","properties":{"name":{"$ref":"#/definitions/container.interval.geofence.name"},"path":{"description":"Series of coordinates","items":{"$ref":"#/definitions/container.interval.geofence.coordinate"},"maxItems":1024,"minItems":3,"type":"array"},"type":{"const":"polygon","default":"polygon","description":"Closed path","readOnly":true,"type":"string"}},"required":["type","path"],"title":"Polygon","type":"object","x-view-order":["type","name","path"],"x-view-shrink-field":"name","x-view-type":"geofence"},"id.result":{"properties":{"result":{"description":"Element's ID list.","items":{"$ref":"#/definitions/item.id"},"type":"array"}},"type":"object"},"item.blocked":{"description":"Active block code for item","type":"integer"},"item.btime":{"description":"Item birth timestamp","type":"double"},"item.cid":{"description":"owner ID","format":"uint32","type":"integer"},"item.enabled":{"description":"Enable or disable item","type":"boolean"},"item.enabled-default":{"default":true,"description":"Enable or disable item","type":"boolean"},"item.id":{"description":"unique item ID","format":"uint32","minimum":1,"type":"integer"},"item.mtime":{"description":"Item last modification timestamp","type":"double"},"item.name":{"description":"Item name","maxLength":1024,"minLength":1,"type":"string"},"item.packets":{"description":"packet data","properties":{"conn":{"description":"Connection ID","minimum":0,"type":"integer"},"data":{"description":"base64 representation of binary data for the packet","maxLength":4194240,"minLength":1,"type":"string"},"timestamp":{"description":"UNIX timestamp of the event","minimum":1,"type":"number","x-view-type":"datetime"},"type":{"description":"3 least significant bits - traffic event type (enum):\n  * 0 - connection is opened\n  * 1 - connection is closed\n  * 2 - incoming data\n  * 3 - outgoing data\n  * 4 - peer identified\nbits 3...7 - traffic transport type bitmask:\n  * 0x00 - tcp\n  * 0x10 - channel\n  * 0x20 - mqtt\n  * 0x40 - http\n  * 0x80 - udp\n","minimum":0,"type":"number"}},"type":"object"},"item.packets.get":{"description":"parameter to filter packets selection","properties":{"count":{"default":10000000,"description":"The number of packets to be returned\n","format":"uint32","maximum":10000000,"minimum":1,"type":"integer"},"filter":{"description":"optional filter string to return only packets conforming to specific filtering rules","maxLength":1024,"type":"string"},"from":{"description":"UNIX timestamp of left time border for packets. Use 0 to ignore left bound.\n","minimum":0,"type":"number","x-view-type":"datetime"},"reverse":{"default":false,"description":"time sorting parameter (true/false), use false to list packets from end to beginning","type":"boolean"},"to":{"description":"UNIX timestamp of right time border for packets. Use 0 to ignore right bound.","minimum":0,"type":"number","x-view-type":"datetime"}},"type":"object"},"item.priority":{"description":"Item priority. The high priority item is processed first.","maximum":100,"minimum":0,"type":"integer"},"item.priority-default":{"default":0,"description":"Item priority. The high priority item is processed first.","maximum":100,"minimum":0,"type":"integer"},"logmessage":{"additionalProperties":true,"description":"Log record. It contains fixed fields described below and additional fields based on log record type.","properties":{"event_code":{"description":"Log record code.","type":"integer"},"event_origin":{"description":"Log record origin name.","type":"string"},"event_text":{"description":"Log record text.","type":"string"},"timestamp":{"description":"Log record UNIX timestamp.","type":"number","x-view-type":"datetime"}},"type":"object"},"logs.get":{"description":"filter returned log records","properties":{"count":{"default":10000000,"description":"limit number of logs to be returned","format":"uint32","maximum":10000000,"minimum":1,"type":"integer"},"fields":{"description":"CSV-formatted list of parameters to be returned in response message list. If message does not contain any of the specified fields, it will be skipped.\n","maxLength":4096,"type":"string"},"filter":{"description":"Optional filter string to return only logs conforming to specific filtering rules. You can use flespi [expressions](https://flespi.com/kb/expressions) and reference log fields inside them.","maxLength":1024,"type":"string"},"from":{"description":"start momemnt's UNIX timestamp to limit log sample from beginning. use 0 to ignore left bound","minimum":0,"type":"number","x-view-type":"datetime"},"reverse":{"default":false,"description":"time sorting parameter (true/false), use false to list logs from end to beginning","type":"boolean"},"to":{"description":"end moment's UNIX timestamp to limit log sample to end. use 0 to ignore right bound","minimum":0,"type":"number","x-view-type":"datetime"}},"type":"object"},"metadata":{"additionalProperties":true,"description":"Set of name/value pairs. Can be used for storing additional information about the item.","format":"metadata","type":"object"},"metadata.patch":{"additionalProperties":true,"description":"Set of name/value pairs. Can be used for storing additional information about the item.","format":"metadata","type":"object"},"search-api-methods.get":{"description":"API method search request","properties":{"queries":{"description":"Search queries describing the API methods you are looking for, e.g. \"how to create a channel\", \"get device messages\".\n","items":{"maxLength":512,"minLength":1,"type":"string"},"maxItems":3,"minItems":1,"type":"array"}},"required":["queries"],"type":"object"},"search-device-documentation.post":{"description":"Device documentation expert consultation","properties":{"device_type_name":{"description":"flespi device type name within the protocol, e.g. \"fmb120\", \"gl300\", \"eco4\".\n","maxLength":128,"minLength":1,"type":"string"},"protocol_name":{"description":"flespi channel protocol name, e.g. \"teltonika\", \"queclink\", \"ruptela\", \"galileo\".\n","maxLength":128,"minLength":1,"type":"string"},"question":{"description":"Question to ask the device documentation expert.\n","maxLength":4096,"minLength":1,"type":"string"}},"required":["protocol_name","device_type_name","question"],"type":"object"},"search-flespi-documentation.post":{"description":"Flespi documentation expert consultation","properties":{"question":{"description":"Question to ask the flespi platform documentation expert.\n","maxLength":4096,"minLength":1,"type":"string"}},"required":["question"],"type":"object"},"subitem.auto_created":{"description":"Flag is set to true when the item is assigned automatically due to belonging to any group","type":"boolean"},"subitem.fields":{"additionalProperties":true,"description":"Auxiliary fields attached to subitem","type":"object"},"subitems.array":{"description":"List of items to which a subitem is added","items":{"properties":{"id":{"$ref":"#/definitions/item.id"},"name":{"$ref":"#/definitions/item.name"}},"type":"object"},"type":"array"},"timezone.enum":{"default":"UTC","description":"Timezone specification","enum":["UTC","Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Atikokan","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Costa_Rica","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Fort_Nelson","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Inuvik","America/Iqaluit","America/Jamaica","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Chita","Asia/Choibalsan","Asia/Colombo","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Hebron","Asia/Ho_Chi_Minh","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kathmandu","Asia/Khandyga","Asia/Kolkata","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Riyadh","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ulaanbaatar","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yangon","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faroe","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Currie","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/Perth","Australia/Sydney","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Ulyanovsk","Europe/Uzhgorod","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Chuuk","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Pohnpei","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Wake","Pacific/Wallis"],"type":"string"},"timezone.enum.base":{"default":"UTC","enum":["UTC","Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Atikokan","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Costa_Rica","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Fort_Nelson","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Inuvik","America/Iqaluit","America/Jamaica","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Chita","Asia/Choibalsan","Asia/Colombo","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Hebron","Asia/Ho_Chi_Minh","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kathmandu","Asia/Khandyga","Asia/Kolkata","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Riyadh","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ulaanbaatar","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yangon","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faroe","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Currie","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/Perth","Australia/Sydney","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Ulyanovsk","Europe/Uzhgorod","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Chuuk","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Pohnpei","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Wake","Pacific/Wallis"],"type":"string"},"tool.response.api-methods":{"description":"API method search response","properties":{"credits":{"description":"Number of AI credits consumed by this call.","minimum":0,"type":"number"},"result":{"description":"Search results with methods, selectors, and response fields.","properties":{"methods":{"description":"Matching API methods.","items":{"properties":{"description":{"description":"API method description.","type":"string"},"link":{"description":"ApiBox documentation URL for the API method (for api-method-schema).","type":"string"},"title":{"description":"API method title.","type":"string"}},"type":"object"},"type":"array"},"response_fields":{"additionalProperties":{"type":"string"},"description":"Response field names for endpoints with structured responses. Keys are \"METHOD /path\" (e.g. \"POST /platform/limits\"). Values are comma-separated field names.\n","type":"object"},"selectors":{"additionalProperties":{"type":"string"},"description":"Deduplicated selector definitions. Keys are selector names (e.g. \"{dev-selector}\"). Values contain first line of description and available field names.\n","type":"object"}},"type":"object"}},"type":"object"},"tool.response.api-schema":{"description":"API schema retrieval response","properties":{"credits":{"description":"Number of AI credits consumed by this call.","minimum":0,"type":"number"},"result":{"description":"API method schema data.","properties":{"link":{"description":"Documentation link for the API method.","type":"string"},"schema":{"description":"Full Swagger 2.0 schema for the API method.","type":"object"},"title":{"description":"API method title.","type":"string"}},"type":"object"}},"type":"object"},"tool.response.generation":{"description":"AI tool response with generation result","properties":{"credits":{"description":"Number of AI credits consumed by this call.","minimum":0,"type":"number"},"result":{"properties":{"generated":{"description":"Whether generation was successful (false when request is impossible or off-topic).","type":"boolean"},"result":{"description":"Generated code/expression on success, or failure explanation.","type":"string"}},"type":"object"}},"type":"object"},"tool.response.text":{"description":"AI tool response with text result","properties":{"credits":{"description":"Number of AI credits consumed by this call.","minimum":0,"type":"number"},"result":{"description":"Tool result text.","type":"string"}},"type":"object"}},"host":"flespi.io","info":{"description":"AI-powered tools and MCP servers for the flespi platform: expert consultation, code generation, REST API discovery, and AI agent integration via [Model Context Protocol](https://modelcontextprotocol.io/).\n\n- **[Tools](/docs/#/ai/tools)** - stateless REST endpoints for individual AI operations (documentation search, code generation, API discovery). Each request is an independent operation with no conversational context.\n- **[MCP](/docs/#/ai/mcp)** - JSON-RPC 2.0 servers that provide AI agents with a full set of flespi tools including the ability to execute REST API calls on your behalf. Use [ACL tokens](https://flespi.com/kb/tokens-access-keys-to-flespi-platform) with minimum required permissions.\n- **[Agents](/docs/#/ai/agents)** - AI agents created by customers to complete various tasks, with capabilities extended by assigned connectors.\n- **[Connectors](/docs/#/ai/connectors)** - AI connectors created by customers from connector types and assigned to agents.\n- **[Connector types](/docs/#/ai/connector-types)** - dictionary of available connector types with connector configuration schemas.\n- **[Logs](/docs/#/ai/logs)** - access to AI operation logs with event codes and usage tracking.\n\nAgents, connectors and connector types are an **experimental** feature under active development: the API may change. See [flespi AI agents](https://flespi.com/kb/flespi-ai-agents) in the KB.\n\nThe [flespi AI integration](https://flespi.com/kb/flespi-ai-integration) KB article guides connecting your own AI tools to flespi.\n\nTo identify each REST request [flespi token](https://flespi.com/kb/tokens-access-keys-to-flespi-platform) has to be passed in the HTTP call via the header: **Authorization: FlespiToken XXXXXXXXXX**.\n","title":"flespi AI REST API\n","version":"1.0"},"parameters":{"agent.connector.fields":{"collectionFormat":"csv","description":"Fields to return in response","in":"query","items":{"enum":["agent_id","connector_id","auto_created","fields","cid","name","enabled","type_id","configuration","metadata","created","blocked","agents_count","item_schema"],"type":"string"},"name":"fields","required":false,"type":"array","x-flespi-fields-description":{"$ref":"#/definitions/agent.connector"}},"agent.connectors.selector":{"collectionFormat":"csv","description":"Select [connectors](/docs/#/ai/connectors) for the API operation.\n\nSome samples you may use in agent.connectors.selector:\n  - **all** - select all connectors available for the user(token), this is special selector format\n  - **1,2,3,4** - select connectors with ID 1,2,3 and 4, this is special selector format\n  - **name=\"XXX\\*\"** - select connectors which name starts from XXX, by field 'name' with wildcards\n","in":"path","items":{"type":"string"},"name":"agent.connectors.selector","required":true,"type":"array","x-flespi-allowed-fields-in-selectors":{"$ref":"#/definitions/connector"},"x-view-selector":"connectors"},"agent.fields":{"collectionFormat":"csv","description":"All possible fields available for the agent.\nIf this parameter is specified in the query path of API call each returned agent will consists only from JSON object with specified fields.\nIf this parameter is not specified each agent will be returned as JSON object with default fields.\n","in":"query","items":{"enum":["id","cid","name","enabled","metadata","created","blocked","connectors_count","messages_read","unread","title","status","waiting","sleep","approvals","approvals_count","steps","duration","executed","updated"],"type":"string"},"name":"fields","required":false,"type":"array","x-flespi-fields-description":{"$ref":"#/definitions/agent"}},"agents.selector":{"collectionFormat":"csv","description":"Select agents for the API operation.\n\nSome samples you may use in agents.selector:\n  - **all** - select all agents available for the user(token), this is special selector format\n  - **1,2,3,4** - select agents with ID 1,2,3 and 4, this is special selector format\n  - **name=\"XXX\\*\"** - select agents which name starts from XXX, by field 'name' with wildcards\n  - **metadata.clientid=4** - select agents which metadata has parameter 'clientid' with value 4, by [agent metadata](https://flespi.com/kb/metadata-entitys-custom-info)\n\nSample API calls:\n  - **GET /ai/agents/all?fields=id,name** - select all available agents and return their id and name\n  - **GET /ai/agents/name=\"my-agent\"?fields=id,name** - select agent with name=\"my-agent\" and return its id and name\n","in":"path","items":{"type":"string"},"name":"agents.selector","required":true,"type":"array","x-flespi-allowed-fields-in-selectors":{"$ref":"#/definitions/agent"},"x-view-selector":"agents"},"cid-header":{"description":"Operate as given subaccount.","in":"header","name":"x-flespi-cid","type":"integer","x-view-selector":"subaccounts"},"connector-type.fields":{"collectionFormat":"csv","description":"All possible fields available for the connector type.\nIf this parameter is specified in the query path of API call each returned connector type will consists only from JSON object with specified fields.\n","in":"query","items":{"enum":["id","name","description","schema","operations"],"type":"string"},"name":"fields","required":false,"type":"array","x-flespi-fields-description":{"$ref":"#/definitions/connector-type"}},"connector-types.selector":{"collectionFormat":"csv","description":"Select connector types for the API operation.\n\nSome samples you may use in connector-types.selector:\n  - **all** - select all connector types, this is special selector format\n  - **1,2,3** - select connector types with ID 1,2 and 3\n  - **name=\"XXX\\*\"** - select connector types which name starts from XXX, by field 'name' with wildcards\n\nSample API calls:\n  - **GET /ai/connector-types/all** - select all available connector types\n  - **GET /ai/connector-types/1?fields=id,name,schema** - select connector type with ID 1 and return its id, name and configuration schema\n","in":"path","items":{"type":"string"},"name":"connector-types.selector","required":true,"type":"array","x-flespi-allowed-fields-in-selectors":{"$ref":"#/definitions/connector-type"},"x-view-selector":"connector-types"},"connector.fields":{"collectionFormat":"csv","description":"All possible fields available for the connector.\nIf this parameter is specified in the query path of API call each returned connector will consists only from JSON object with specified fields.\nIf this parameter is not specified each connector will be returned as JSON object with default fields.\n","in":"query","items":{"enum":["id","cid","name","enabled","type_id","configuration","metadata","created","blocked","agents_count","item_schema"],"type":"string"},"name":"fields","required":false,"type":"array","x-flespi-fields-description":{"$ref":"#/definitions/connector"}},"connectors.selector":{"collectionFormat":"csv","description":"Select connectors for the API operation.\n\nSome samples you may use in connectors.selector:\n  - **all** - select all connectors available for the user(token), this is special selector format\n  - **1,2,3,4** - select connectors with ID 1,2,3 and 4, this is special selector format\n  - **name=\"XXX\\*\"** - select connectors which name starts from XXX, by field 'name' with wildcards\n  - **metadata.clientid=4** - select connectors which metadata has parameter 'clientid' with value 4, by [connector metadata](https://flespi.com/kb/metadata-entitys-custom-info)\n\nSample API calls:\n  - **GET /ai/connectors/all?fields=id,name** - select all available connectors and return their id and name\n  - **GET /ai/connectors/name=\"my-connector\"?fields=id,name** - select connector with name=\"my-connector\" and return its id and name\n","in":"path","items":{"type":"string"},"name":"connectors.selector","required":true,"type":"array","x-flespi-allowed-fields-in-selectors":{"$ref":"#/definitions/connector"},"x-view-selector":"connectors"},"force-header":{"description":"Set to 1 in order to force operation completion ignoring some checks","enum":[0,1],"in":"header","name":"x-flespi-force","type":"integer"},"limit":{"description":"Maximum number of items to return.\n","in":"query","name":"limit","required":false,"type":"integer"},"offset":{"description":"Number of items to skip before starting to return results.\n","in":"query","name":"offset","required":false,"type":"integer"}},"paths":{"/agents":{"post":{"description":"Create new agent with specified configuration parameters. You pass JSON array with configuration objects - one object per each agent to create.\nCall format: **POST /ai/agents?fields=field1,field2,field3**\nwhere fields is optional argument to minimize the size of returned JSON for each created agent\n","parameters":[{"$ref":"#/parameters/cid-header"},{"$ref":"#/parameters/agent.fields"},{"in":"body","name":"data","required":true,"schema":{"$ref":"#/definitions/agents.post"}}],"responses":{"200":{"description":"Agents collection","schema":{"$ref":"#/definitions/agents.result"}},"400":{"description":"Incorrect parameters","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Create new agent","tags":["agents"],"x-flespi-extra-parameters":{"grant-access":"create-agents"},"x-view-group":"Manage"}},"/agents/{agents.selector}":{"delete":{"description":"The method will permanently delete selected agents to which current user(token) has access to. Use with caution!\n\nUse special keyword \"all\" to delete all agents available for current user(token). Specify filtering conditions within path in 'agents.selector' to delete only agents that conforms to specified criterias.\n\nBefore the deletion it is recommended to check for agents that will be deleted by calling corresponding GET method.\n\nCall format: **DELETE /ai/agents/{agents.selector}**\n","parameters":[{"$ref":"#/parameters/agents.selector"}],"responses":{"200":{"description":"Agents collection","schema":{"$ref":"#/definitions/id.result"}},"400":{"description":"Incorrect parameters","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Delete selected agents","tags":["agents"],"x-view-group":"Manage"},"get":{"description":"Get collection of agents available for user(token).\n\nUse special keyword \"all\" to retrieve all agents. Specify filtering conditions within path in 'agents.selector' to retrieve only agents that conforms to specified criterias.\n\nCall format: **GET /ai/agents/{agents.selector}?fields=field1,field2,field3&limit=10&offset=0**\nwhere fields, limit and offset are optional arguments to minimize the size of returned JSON\n","parameters":[{"$ref":"#/parameters/agents.selector"},{"$ref":"#/parameters/agent.fields"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/offset"}],"responses":{"200":{"description":"Agents collection","schema":{"$ref":"#/definitions/agents.result"}},"400":{"description":"Incorrect parameters","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"List available agents","tags":["agents"],"x-view-group":"Manage"},"parameters":[{"$ref":"#/parameters/cid-header"}],"patch":{"description":"The patch method is similar to PUT method but it is used to update only specified keys of the item's JSON fields like metadata.\n\nCall format: **PATCH /ai/agents/{agents.selector}**.\n","parameters":[{"$ref":"#/parameters/agents.selector"},{"$ref":"#/parameters/agent.fields"},{"in":"body","name":"data","required":true,"schema":{"$ref":"#/definitions/agents.put"}}],"responses":{"200":{"description":"Agents collection","schema":{"$ref":"#/definitions/agents.result"}},"400":{"description":"Incorrect parameters","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Patch item properties","tags":["agents"],"x-view-group":"Manage"},"put":{"description":"Update specified properties for selected agents.\n\nUse special keyword \"all\" to select all agents available for current user(token) for update. Specify filtering conditions within path in 'agents.selector' to update only agents that conforms to specified criterias.\n\nBefore the update it is recommended to check for agents that will be updated by calling corresponding GET method.\n\nCall format: **PUT /ai/agents/{agents.selector}?fields=field1,field2,field3**\nwhere fields is an optional argument to minimize the size of returned JSON\n","parameters":[{"$ref":"#/parameters/agents.selector"},{"$ref":"#/parameters/agent.fields"},{"in":"body","name":"data","required":true,"schema":{"$ref":"#/definitions/agents.put"}}],"responses":{"200":{"description":"Agents collection","schema":{"$ref":"#/definitions/agents.result"}},"400":{"description":"Incorrect parameters","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Modify agent properties","tags":["agents"],"x-view-group":"Manage"}},"/agents/{agents.selector}/approvals":{"parameters":[{"$ref":"#/parameters/cid-header"},{"$ref":"#/parameters/agents.selector"}],"post":{"description":"Resolve the posted pending approval requests of the selected agents: each posted resolution identifies its\napproval by the timestamp, a granted operation is executed by the agent, a rejected one is discarded\nand the reason is recorded for the agent.\n\nThe pending requests are listed in the \"approvals\" field of the agent, each carrying the timestamp to post back.\nA 200 response lists the applied decisions in its result array: a granted operation executes right away, between reasoning\nsteps, and its outcome lands in the agent history, readable via **GET /ai/agents/{agents.selector}/messages**.\nA request timestamp belongs to exactly one agent, so resolve it against the agent that raised it.\nEvery posted resolution is tried against every selected agent, a miss is reported in the errors array.\nA failed resolution names its approval timestamp (six decimal places) in the reason text of its errors entry; an agent-level failure, e.g. a blocked or unavailable agent, is reported without one.\nAn overdue request (past its \"expires\" time) can still be resolved until the agent processes the timeout.\nUnknown or already resolved requests are reported in the errors array of the response while the rest still\nresolve; when every posted resolution fails, the response is a 400 (or a 503 when every failure is retryable) carrying the same errors array.\nTwo resolutions of one request in a single call conflict and fail the whole request with a 400.\nThe approvals of a blocked agent are closed for resolution.\n\nCall format: **POST /ai/agents/{agents.selector}/approvals** with an array of resolutions in the request body.\n","parameters":[{"in":"body","name":"data","required":true,"schema":{"description":"Approval resolutions array.","items":{"$ref":"#/definitions/agent.approval.resolution"},"maxItems":200,"minItems":1,"type":"array"}}],"responses":{"200":{"description":"Collection of resolved approval requests","schema":{"$ref":"#/definitions/agents.approvals.result"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons, or the agent is blocked.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"},"503":{"description":"The agent is temporarily not available, or the request could not be completed, retry later.","schema":{"$ref":"#/definitions/errors.result"}}},"security":[{"FlespiToken":[]}],"summary":"Resolve approval requests","tags":["agents"],"x-view-group":"Manage"}},"/agents/{agents.selector}/connectors/{agent.connectors.selector}":{"delete":{"description":"Unassign connectors from selected agents.\n\nSpecify agents from which to unassign connectors within path in 'agents.selector' parameter.\nSpecify connectors which to unassign from agents within path in 'agent.connectors.selector' parameter.\n\nBefore the unassignment it is recommended to check for agents and connectors that will be affected by calling corresponding GET method.\n\nCall format: **DELETE /ai/agents/{agents.selector}/connectors/{agent.connectors.selector}**.\n","responses":{"200":{"description":"IDs of unassigned connectors","schema":{"$ref":"#/definitions/id.result"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Unassign connectors from agent","tags":["agents"],"x-flespi-extra-parameters":{"subitem-acl":"ai/connectors"},"x-view-group":"Assigned connectors"},"get":{"description":"Retrieve connectors that are assigned to selected agents.\n\nSpecify agents for which to retrieve assigned connectors within path in 'agents.selector' parameter.\nSpecify connectors within path in 'agent.connectors.selector' parameter or use special value 'all' to retrieve all connectors that are assigned to selected agents.\n\nCall format: **GET /ai/agents/{agents.selector}/connectors/{agent.connectors.selector}**.\n","parameters":[{"$ref":"#/parameters/agent.connector.fields"}],"responses":{"200":{"description":"Collection of connectors assigned to agent","schema":{"$ref":"#/definitions/agent.connectors"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Retrieve connectors assigned to agent","tags":["agents"],"x-flespi-extra-parameters":{"subitem-acl":"ai/connectors"},"x-view-group":"Assigned connectors"},"parameters":[{"$ref":"#/parameters/cid-header"},{"$ref":"#/parameters/agents.selector"},{"$ref":"#/parameters/agent.connectors.selector"}],"post":{"description":"Assign connectors to selected agents.\n\nSpecify agents to which assign connectors within path in 'agents.selector' parameter.\nSpecify connectors which to assign to agents within path in 'agent.connectors.selector' parameter.\n\nOptional binding fields hold the agent operations ACL rules, one per operation declared by the connector type, omitted fields take the default rule declared by the operation.\n\nCall format: **POST /ai/agents/{agents.selector}/connectors/{agent.connectors.selector}**.\n","parameters":[{"$ref":"#/parameters/agent.connector.fields"},{"in":"body","name":"data","required":false,"schema":{"$ref":"#/definitions/agent.connector.post"}}],"responses":{"200":{"description":"Collection of connectors assigned to agent","schema":{"$ref":"#/definitions/agent.connectors"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"},"503":{"description":"The request could not be completed, retry later.","schema":{"$ref":"#/definitions/errors.result"}}},"security":[{"FlespiToken":[]}],"summary":"Assign connectors to agent","tags":["agents"],"x-flespi-extra-parameters":{"subitem-acl":"ai/connectors"},"x-view-group":"Assigned connectors"},"put":{"description":"Replace the binding fields of connectors already assigned to selected agents.\nA selected connector that is not assigned to the agent is skipped, the response then carries an empty collection.\n\nThe binding fields hold the agent operations ACL rules, one per operation declared by the connector type, omitted fields take the default rule declared by the operation.\n\nCall format: **PUT /ai/agents/{agents.selector}/connectors/{agent.connectors.selector}**.\n","parameters":[{"$ref":"#/parameters/agent.connector.fields"},{"in":"body","name":"data","required":true,"schema":{"$ref":"#/definitions/agent.connector.post"}}],"responses":{"200":{"description":"Collection of connectors assigned to agent","schema":{"$ref":"#/definitions/agent.connectors"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"},"503":{"description":"The request could not be completed, retry later.","schema":{"$ref":"#/definitions/errors.result"}}},"security":[{"FlespiToken":[]}],"summary":"Update connectors assigned to agent","tags":["agents"],"x-flespi-extra-parameters":{"subitem-acl":"ai/connectors"},"x-view-group":"Assigned connectors"}},"/agents/{agents.selector}/logs":{"get":{"description":"Get specified agent logs. The request without parameters will return all agent logs.\n\n'agents.selector' specifies selection of agents from which to retrieve logs. You may select 'all' agents or select them by ID, name and other criterias specified in agents.selector.\n\nReply contains agent logs sorted by timestamp, in case you request logs from multiple agents sort order is not preserved.\n\nTo improve the performance of the call try always to specify 'from' and 'to' parameters with corresponding UNIX timestamps for which you want to retrieve agent logs.\nIf you will specify it only inside 'filter' the call will still iterate through all logs in agent which on large volumes may slow down your operation.\n\n'filter' parameter can be used to select only subset of logs. In filter you can utilize powerful [flespi expressions](https://flespi.com/kb/expressions).\n\nCall format: **GET /ai/agents/{agents.selector}/logs**.\n","parameters":[{"$ref":"#/parameters/agents.selector"},{"description":"Parameters to filter retrieved logs","in":"query","name":"data","schema":{"$ref":"#/definitions/logs.get"}}],"responses":{"200":{"description":"Log messages array","schema":{"properties":{"errors":{"$ref":"#/definitions/errors"},"result":{"description":"Logs collection","items":{"$ref":"#/definitions/logmessage"},"type":"array"}},"type":"object"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Retrieve agent logs","tags":["agents"],"x-view-group":"Utils"},"parameters":[{"$ref":"#/parameters/cid-header"}]},"/agents/{agents.selector}/logs/calculate":{"get":{"description":"Calculate intervals from logs for specified agent.\n\nCall format: **GET /ai/agents/{agents.selector}/logs/calculate**.\n","parameters":[{"description":"Parameters for interval calculation","in":"query","name":"data","required":true,"schema":{"$ref":"#/definitions/container.intervals.calculate"}}],"responses":{"200":{"description":"Calculated intervals","schema":{"properties":{"errors":{"$ref":"#/definitions/errors"},"result":{"description":"Calculated intervals collection","type":"array"}},"type":"object"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Calculate intervals from agent logs","tags":["agents"],"x-view-group":"Utils"},"parameters":[{"$ref":"#/parameters/cid-header"},{"$ref":"#/parameters/agents.selector"}]},"/agents/{agents.selector}/messages":{"get":{"description":"Retrieve history records of the selected agents: the feed the agent writes its messages, executed operations and activity records into.\n\nRecords are selected by their timestamp keys, from the \"from\" key up to the \"to\" key inclusive.\n\nCall format: **GET /ai/agents/{agents.selector}/messages**.\n","parameters":[{"description":"History records selection parameters","in":"query","name":"data","required":false,"schema":{"$ref":"#/definitions/agent.history.select"}}],"responses":{"200":{"description":"Collection of history records","schema":{"$ref":"#/definitions/agent.history.result"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons, or the agent is blocked.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Retrieve agent history","tags":["agents"],"x-view-group":"Manage"},"parameters":[{"$ref":"#/parameters/cid-header"},{"$ref":"#/parameters/agents.selector"}],"post":{"consumes":["multipart/form-data"],"description":"Queue a message to the selected agents.\n\nAttached files are uploaded into the CDN of each selected agent and reach it as the message attachments.\n\nCall format: **POST /ai/agents/{agents.selector}/messages**.\n","parameters":[{"description":"message file attachment, up to 8 files per message","in":"formData","name":"file","required":false,"type":"file"},{"description":"message parameters","in":"formData","name":"data","required":true,"schema":{"$ref":"#/definitions/agent.message.post"}}],"responses":{"200":{"description":"Collection of queued messages","schema":{"$ref":"#/definitions/agents.messages.result"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons, or the agent is blocked.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"},"503":{"description":"The agent is temporarily not available, or the request could not be completed, retry later.","schema":{"$ref":"#/definitions/errors.result"}}},"security":[{"FlespiToken":[]}],"summary":"Send message to agent","tags":["agents"],"x-view-group":"Manage"}},"/agents/{agents.selector}/messages/pending":{"delete":{"description":"Retract a still-unread pending message of the selected agents: a message that arrived while the agent\nwas busy reasoning is removed before the agent ever sees it.\n\nA message received by a busy agent lives in its own retained MQTT state topic **flespi/state/ai/agents/{agent-id}/messages/pending/{timestamp}**\nuntil the agent takes it: the topic carries the same record the message later lands in the history feed with.\nThe timestamp identifying the message is the one the message POST returned, also the key of its pending state topic.\nWhen the agent reads the message during its ongoing reasoning step, the topic payload is restamped with the \"seen\" flag\nand the retraction is refused with the reason in the errors array; a message whose reading step fails before\ncompletion returns to the retractable pending state.\nOnly messages retract: an informational record on the pending topic (e.g. a chat link lifecycle event) answers a refusal.\n\nCall format: **DELETE /ai/agents/{agents.selector}/messages/pending**.\n","parameters":[{"description":"Parameters selecting the pending message to retract.","in":"body","name":"data","required":true,"schema":{"$ref":"#/definitions/agent.messages.pending.delete"}}],"responses":{"200":{"description":"Collection of retracted pending messages.","schema":{"$ref":"#/definitions/agents.retractions.result"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons, or the agent is blocked.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"},"503":{"description":"The agent is temporarily not available, or the request could not be completed, retry later.","schema":{"$ref":"#/definitions/errors.result"}}},"security":[{"FlespiToken":[]}],"summary":"Retract a pending message","tags":["agents"],"x-view-group":"Manage"},"parameters":[{"$ref":"#/parameters/cid-header"},{"$ref":"#/parameters/agents.selector"}]},"/agents/{agents.selector}/messages/read":{"parameters":[{"$ref":"#/parameters/cid-header"},{"$ref":"#/parameters/agents.selector"}],"post":{"description":"Publish the read marker of the agent chat: the timestamp of the newest history record the account has read.\n\nThe marker is stored in the retained MQTT state topic **flespi/state/ai/agents/{agent-id}/messages_read** with the posted\ntimestamp as its payload and is returned in the \"messages_read\" field of the agent, so every chat view of the agent\nshares the same reading position. The posted value fully replaces the previous one, so the marker moves in both\ndirections - e.g. backward to mark records unread again.\n\nThe derived \"unread\" flag of the agent follows the marker: set while the \"updated\" time is ahead of it,\nexposed in the \"unread\" field and the **flespi/state/ai/agents/{agent-id}/unread** state topic.\n\nCall format: **POST /ai/agents/{agents.selector}/messages/read**.\n","parameters":[{"description":"The read marker value to publish.","in":"body","name":"data","required":true,"schema":{"$ref":"#/definitions/agent.messages.read.post"}}],"responses":{"200":{"description":"Collection of published read markers.","schema":{"$ref":"#/definitions/agents.markers.result"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Set the chat read marker","tags":["agents"],"x-view-group":"Manage"}},"/changelog-posts":{"get":{"description":"Retrieve changelog posts accumulated for the flespi AI system, sorted by publication time.\n\nEach post published in a forum changelog topic of the AI system is stored by the platform and available with this method.\nThe 'name' field of the post carries the name of the specific changelog it belongs to, e.g. 'ai'.\nNew posts are also published in realtime into 'flespi/message/ai/changelog' MQTT topic.\n\nAll filtering parameters should be wrapped inside data={...} argument, for example to return only the latest post use:\n**GET /ai/changelog-posts?data={\"reverse\":true,\"count\":1}**\n\nCall format: **GET /ai/changelog-posts**\n\nBoth the MQTT topic and this method are accessible with any token of the account, including ACL tokens, no extra permissions required.\n","parameters":[{"in":"query","name":"data","schema":{"$ref":"#/definitions/changelog.get"}}],"responses":{"200":{"description":"Changelog posts array.","schema":{"$ref":"#/definitions/changelog.posts"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Fetch changelog posts of the AI system","tags":["changelog"],"x-view-group":"Changelog"}},"/connector-types/{connector-types.selector}":{"get":{"description":"Get collection of AI connector types.\n\nUse special keyword \"all\" to retrieve all connector types or list required type IDs in 'connector-types.selector'.\n\nCall format: **GET /ai/connector-types/{connector-types.selector}?fields=field1,field2,field3**\nwhere fields is optional argument to minimize the size of returned JSON\n","parameters":[{"$ref":"#/parameters/connector-types.selector"},{"$ref":"#/parameters/connector-type.fields"}],"responses":{"200":{"description":"Connector types collection","schema":{"$ref":"#/definitions/connector-types.result"}},"400":{"description":"Incorrect parameters","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Fetch available connector types","tags":["connector-types"]}},"/connectors":{"post":{"description":"Create new connector with specified configuration parameters. You pass JSON array with configuration objects - one object per each connector to create.\nCall format: **POST /ai/connectors?fields=field1,field2,field3**\nwhere fields is optional argument to minimize the size of returned JSON for each created connector\n","parameters":[{"$ref":"#/parameters/cid-header"},{"$ref":"#/parameters/connector.fields"},{"in":"body","name":"data","required":true,"schema":{"$ref":"#/definitions/connectors.post"}}],"responses":{"200":{"description":"Connectors collection","schema":{"$ref":"#/definitions/connectors.result"}},"400":{"description":"Incorrect parameters","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Create new connector","tags":["connectors"],"x-flespi-extra-parameters":{"grant-access":"create-connectors"},"x-view-group":"Manage"}},"/connectors/{connectors.selector}":{"delete":{"description":"The method will permanently delete selected connectors to which current user(token) has access to. Deleted connectors are also unassigned from all agents. Use with caution!\n\nUse special keyword \"all\" to delete all connectors available for current user(token). Specify filtering conditions within path in 'connectors.selector' to delete only connectors that conforms to specified criterias.\n\nBefore the deletion it is recommended to check for connectors that will be deleted by calling corresponding GET method.\n\nCall format: **DELETE /ai/connectors/{connectors.selector}**\n","parameters":[{"$ref":"#/parameters/connectors.selector"}],"responses":{"200":{"description":"Connectors collection","schema":{"$ref":"#/definitions/id.result"}},"400":{"description":"Incorrect parameters","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Delete selected connectors","tags":["connectors"],"x-view-group":"Manage"},"get":{"description":"Get collection of connectors available for user(token).\n\nUse special keyword \"all\" to retrieve all connectors. Specify filtering conditions within path in 'connectors.selector' to retrieve only connectors that conforms to specified criterias.\n\nCall format: **GET /ai/connectors/{connectors.selector}?fields=field1,field2,field3&limit=10&offset=0**\nwhere fields, limit and offset are optional arguments to minimize the size of returned JSON\n","parameters":[{"$ref":"#/parameters/connectors.selector"},{"$ref":"#/parameters/connector.fields"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/offset"}],"responses":{"200":{"description":"Connectors collection","schema":{"$ref":"#/definitions/connectors.result"}},"400":{"description":"Incorrect parameters","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"List available connectors","tags":["connectors"],"x-view-group":"Manage"},"parameters":[{"$ref":"#/parameters/cid-header"}],"patch":{"description":"The patch method is similar to PUT method but it is used to update only specified keys of the item's JSON fields like metadata.\n\nCall format: **PATCH /ai/connectors/{connectors.selector}**.\n","parameters":[{"$ref":"#/parameters/connectors.selector"},{"$ref":"#/parameters/connector.fields"},{"in":"body","name":"data","required":true,"schema":{"$ref":"#/definitions/connectors.put"}}],"responses":{"200":{"description":"Connectors collection","schema":{"$ref":"#/definitions/connectors.result"}},"400":{"description":"Incorrect parameters","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Patch item properties","tags":["connectors"],"x-view-group":"Manage"},"put":{"description":"Update specified properties for selected connectors.\n\nUse special keyword \"all\" to select all connectors available for current user(token) for update. Specify filtering conditions within path in 'connectors.selector' to update only connectors that conforms to specified criterias.\n\nBefore the update it is recommended to check for connectors that will be updated by calling corresponding GET method.\n\nCall format: **PUT /ai/connectors/{connectors.selector}?fields=field1,field2,field3**\nwhere fields is an optional argument to minimize the size of returned JSON\n","parameters":[{"$ref":"#/parameters/connectors.selector"},{"$ref":"#/parameters/connector.fields"},{"in":"body","name":"data","required":true,"schema":{"$ref":"#/definitions/connectors.put"}}],"responses":{"200":{"description":"Connectors collection","schema":{"$ref":"#/definitions/connectors.result"}},"400":{"description":"Incorrect parameters","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Modify connector properties","tags":["connectors"],"x-view-group":"Manage"}},"/connectors/{connectors.selector}/logs":{"get":{"description":"Get specified connector logs. The request without parameters will return all connector logs.\n\n'connectors.selector' specifies selection of connectors from which to retrieve logs. You may select 'all' connectors or select them by ID, name and other criterias specified in connectors.selector.\n\nReply contains connector logs sorted by timestamp, in case you request logs from multiple connectors sort order is not preserved.\n\nTo improve the performance of the call try always to specify 'from' and 'to' parameters with corresponding UNIX timestamps for which you want to retrieve connector logs.\nIf you will specify it only inside 'filter' the call will still iterate through all logs in connector which on large volumes may slow down your operation.\n\n'filter' parameter can be used to select only subset of logs. In filter you can utilize powerful [flespi expressions](https://flespi.com/kb/expressions).\n\nCall format: **GET /ai/connectors/{connectors.selector}/logs**.\n","parameters":[{"$ref":"#/parameters/connectors.selector"},{"description":"Parameters to filter retrieved logs","in":"query","name":"data","schema":{"$ref":"#/definitions/logs.get"}}],"responses":{"200":{"description":"Log messages array","schema":{"properties":{"errors":{"$ref":"#/definitions/errors"},"result":{"description":"Logs collection","items":{"$ref":"#/definitions/logmessage"},"type":"array"}},"type":"object"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Retrieve connector logs","tags":["connectors"],"x-view-group":"Utils"},"parameters":[{"$ref":"#/parameters/cid-header"}]},"/connectors/{connectors.selector}/logs/calculate":{"get":{"description":"Calculate intervals from logs for specified connector.\n\nCall format: **GET /ai/connectors/{connectors.selector}/logs/calculate**.\n","parameters":[{"description":"Parameters for interval calculation","in":"query","name":"data","required":true,"schema":{"$ref":"#/definitions/container.intervals.calculate"}}],"responses":{"200":{"description":"Calculated intervals","schema":{"properties":{"errors":{"$ref":"#/definitions/errors"},"result":{"description":"Calculated intervals collection","type":"array"}},"type":"object"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Calculate intervals from connector logs","tags":["connectors"],"x-view-group":"Utils"},"parameters":[{"$ref":"#/parameters/cid-header"},{"$ref":"#/parameters/connectors.selector"}]},"/logs":{"get":{"description":"Get specified AI operation logs. The request without parameters will return all AI operation logs.\n\nReply contains AI operation logs sorted by timestamp.\n\nTo improve the performance of the call try always to specify 'from' and 'to' parameters with corresponding UNIX timestamps for which you want to retrieve AI logs.\nIf you will specify it only inside 'filter' the call will still iterate through all AI logs which on large volumes may slow down your operation.\n\n'filter' parameter can be used to select only subset of logs. In filter you can utilize powerful [flespi expressions](https://flespi.com/kb/expressions).\n\nCall format: **GET /ai/logs**.\n","parameters":[{"description":"Parameters to filter returned logs","in":"query","name":"data","schema":{"$ref":"#/definitions/logs.get"}}],"responses":{"200":{"description":"Retrieved logs","schema":{"properties":{"errors":{"$ref":"#/definitions/errors"},"result":{"description":"Logs collection","items":{"$ref":"#/definitions/logmessage"},"type":"array"}},"type":"object"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Retrieve AI operation logs","tags":["logs"],"x-flespi-extra-parameters":{"grant-access":"operate-as","uri-prefix":"ai"},"x-view-group":"Utils"},"parameters":[{"$ref":"#/parameters/cid-header"}]},"/logs/calculate":{"get":{"description":"Calculate intervals from AI operation logs.\n\nCall format: **GET /ai/logs/calculate**.\n","parameters":[{"description":"Parameters for interval calculation","in":"query","name":"data","required":true,"schema":{"$ref":"#/definitions/container.intervals.calculate"}}],"responses":{"200":{"description":"Calculated intervals","schema":{"properties":{"errors":{"$ref":"#/definitions/errors"},"result":{"description":"Calculated intervals collection","type":"array"}},"type":"object"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n","schema":{"$ref":"#/definitions/errors.result"}},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Calculate intervals from AI logs","tags":["logs"],"x-flespi-extra-parameters":{"grant-access":"operate-as","uri-prefix":"ai"},"x-view-group":"Utils"},"parameters":[{"$ref":"#/parameters/cid-header"}]},"/mcp/develop":{"get":{"description":"SSE transport endpoint for the develop MCP server. Not currently supported - use POST instead.\n","parameters":[],"responses":{"200":{"description":"SSE stream (if supported)"},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n"},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n"},"405":{"description":"SSE not supported by this server."}},"security":[{"FlespiToken":[]}],"summary":"MCP server for development agents","tags":["mcp"],"x-flespi-extra-parameters":{"grant-access":"operate-as"}},"parameters":[{"$ref":"#/parameters/cid-header"}],"post":{"description":"MCP server for AI agents building applications on top of flespi.\n\nAccepts MCP JSON-RPC 2.0 requests. Use `initialize` to start a session, `tools/list` to discover available tools, and `tools/call` to invoke tools.\n\nThe agent receives instructions about flespi platform entities, API namespaces, and a recommended workflow for discovering and calling API methods. The token you provide determines which API calls the agent can make via the `flespi-api-read` and `flespi-api-write` tools - use an [ACL token](https://flespi.com/kb/tokens-access-keys-to-flespi-platform) with `POST ai/mcp` plus the downstream API sections the agent should reach; see Token security above.\n\nCall format: **POST /ai/mcp/develop**.\n","parameters":[{"description":"JSON-RPC 2.0 request envelope (`jsonrpc`, `method`, `params`, optional `id`).","in":"body","name":"data","required":true,"schema":{"additionalProperties":true,"type":"object"}}],"responses":{"200":{"description":"JSON-RPC 2.0 response envelope. Carries `result` on success or `error` on failure; the `result` payload shape depends on the invoked MCP method - see the MCP specification.\n","schema":{"additionalProperties":true,"type":"object"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n"},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n"}},"security":[{"FlespiToken":[]}],"summary":"MCP server for development agents","tags":["mcp"],"x-flespi-extra-parameters":{"grant-access":"operate-as"}}},"/mcp/support":{"get":{"description":"SSE transport endpoint for the support MCP server. Not currently supported - use POST instead.\n","parameters":[],"responses":{"200":{"description":"SSE stream (if supported)"},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n"},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n"},"405":{"description":"SSE not supported by this server."}},"security":[{"FlespiToken":[]}],"summary":"MCP server for support agents","tags":["mcp"],"x-flespi-extra-parameters":{"grant-access":"operate-as"}},"parameters":[{"$ref":"#/parameters/cid-header"}],"post":{"description":"MCP server for AI agents assisting with flespi platform support.\n\nAccepts MCP JSON-RPC 2.0 requests. Use `initialize` to start a session, `tools/list` to discover available tools, and `tools/call` to invoke tools.\n\nThe agent receives instructions with diagnostic patterns for common issues (connectivity, data gaps, stream failures, permission errors) and investigation guidance. For a read-only support agent, use an [ACL token](https://flespi.com/kb/tokens-access-keys-to-flespi-platform) with `POST ai/mcp` (required to open the MCP session) plus `GET` on the downstream sections the agent should read; see Token security above.\n\nCall format: **POST /ai/mcp/support**.\n","parameters":[{"description":"JSON-RPC 2.0 request envelope (`jsonrpc`, `method`, `params`, optional `id`).","in":"body","name":"data","required":true,"schema":{"additionalProperties":true,"type":"object"}}],"responses":{"200":{"description":"JSON-RPC 2.0 response envelope. Carries `result` on success or `error` on failure; the `result` payload shape depends on the invoked MCP method - see the MCP specification.\n","schema":{"additionalProperties":true,"type":"object"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n"},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n"}},"security":[{"FlespiToken":[]}],"summary":"MCP server for support agents","tags":["mcp"],"x-flespi-extra-parameters":{"grant-access":"operate-as"}}},"/tools/api-method-schema":{"get":{"description":"Retrieve full Swagger 2.0 schema for a specific flespi REST API method.\nIdentified by documentation link from the [flespi API documentation](https://flespi.io/docs).\nReturns the method link, title and full schema object.\n\nUse the **/ai/tools/search-api-methods** endpoint first to discover relevant API methods and their documentation links.\n\nCall format: **GET /ai/tools/api-method-schema**.\n","parameters":[{"in":"query","name":"data","required":true,"schema":{"$ref":"#/definitions/api-method-schema.get"}}],"responses":{"200":{"description":"API method schema.","schema":{"$ref":"#/definitions/tool.response.api-schema"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n"},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n"},"429":{"description":"Too many requests - ai_calls rate limit exceeded.","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Retrieve REST API method schema","tags":["tools"],"x-flespi-extra-parameters":{"grant-access":"operate-as"},"x-view-group":"API"},"parameters":[{"$ref":"#/parameters/cid-header"}]},"/tools/consult-flespi-account":{"parameters":[{"$ref":"#/parameters/cid-header"}],"post":{"description":"Delegate a complex question to a flespi platform expert with read access to your account.\nThe expert has deep platform knowledge and can perform multi-step analysis across account resources using your token permissions.\n\nBest for complex analysis requiring platform expertise - investigating multi-component issues, understanding platform behavior, analyzing account configuration, troubleshooting connectivity or data issues.\nFor documentation-only questions without account context, prefer **/ai/tools/search-flespi-documentation**.\n\nLatency: complex consultations may take up to 5 minutes.\n\nCall format: **POST /ai/tools/consult-flespi-account**.\n","parameters":[{"description":"Account consultation request","in":"body","name":"data","required":true,"schema":{"$ref":"#/definitions/consult-flespi-account.post"}}],"responses":{"200":{"description":"Expert consultation response.","schema":{"$ref":"#/definitions/tool.response.text"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n"},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n"},"429":{"description":"Too many requests - ai_calls rate limit exceeded.","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Consult flespi account expert","tags":["tools"],"x-flespi-extra-parameters":{"grant-access":"operate-as"},"x-view-group":"Experts"}},"/tools/generate-flespi-expression":{"parameters":[{"$ref":"#/parameters/cid-header"}],"post":{"description":"Generate [flespi expressions](https://flespi.com/kb/expressions) for REST API selectors, calculator selectors/counters, webhook templating, plugin expressions, stream expressions, and MQTT filters.\n\nProvide a question or task description for expression generation.\n\nThe response includes a structured result with `generated` boolean (whether generation succeeded) and `result` string (the expression or failure explanation), plus credits consumed.\n\nCall format: **POST /ai/tools/generate-flespi-expression**.\n","parameters":[{"description":"Expression generation request","in":"body","name":"data","required":true,"schema":{"$ref":"#/definitions/generate-flespi-expression.post"}}],"responses":{"200":{"description":"Generated flespi expression.","schema":{"$ref":"#/definitions/tool.response.generation"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n"},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n"},"429":{"description":"Too many requests - ai_calls rate limit exceeded.","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Generate flespi expression","tags":["tools"],"x-flespi-extra-parameters":{"grant-access":"operate-as"},"x-view-group":"Utils"}},"/tools/generate-pvm-code":{"parameters":[{"$ref":"#/parameters/cid-header"}],"post":{"description":"Generate PVM (Parsing Virtual Machine) code from a task description.\nPVM is a domain-specific language used in flespi for processing device messages - filtering, transforming and enriching telemetry data.\n\nProvide a detailed task description including input and output message specifications for best results.\n\nThe response includes the generated PVM code text and the number of credits consumed.\n\nCall format: **POST /ai/tools/generate-pvm-code**.\n","parameters":[{"description":"PVM code generation request","in":"body","name":"data","required":true,"schema":{"$ref":"#/definitions/generate-pvm-code.post"}}],"responses":{"200":{"description":"Generated PVM code.","schema":{"$ref":"#/definitions/tool.response.generation"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n"},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n"},"429":{"description":"Too many requests - ai_calls rate limit exceeded.","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Generate PVM code","tags":["tools"],"x-flespi-extra-parameters":{"grant-access":"operate-as"},"x-view-group":"Utils"}},"/tools/search-api-methods":{"get":{"description":"Semantic search for flespi REST API methods by natural language queries.\n\nProvide 1 to 3 queries describing the API methods you need.\nEach query is matched independently against flespi API documentation and results are merged.\n\nReturns **methods** array with link, title and description.\nAlso returns a deduplicated **selectors** object with field names for each entity selector, and a **response_fields** object with field names for endpoints with structured responses.\n\nCall format: **GET /ai/tools/search-api-methods**.\n","parameters":[{"in":"query","name":"data","required":true,"schema":{"$ref":"#/definitions/search-api-methods.get"}}],"responses":{"200":{"description":"Matching API methods.","schema":{"$ref":"#/definitions/tool.response.api-methods"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n"},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n"},"429":{"description":"Too many requests - ai_calls rate limit exceeded.","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Search for REST API methods","tags":["tools"],"x-flespi-extra-parameters":{"grant-access":"operate-as"},"x-view-group":"API"},"parameters":[{"$ref":"#/parameters/cid-header"}]},"/tools/search-device-documentation":{"parameters":[{"$ref":"#/parameters/cid-header"}],"post":{"description":"Ask AI expert a question about a specific tracking device.\nThe expert searches device manufacturer's manual and protocol documentation.\n\nYou need to specify flespi **protocol_name** and **device_type_name** to identify the device you are asking about.\nBoth values can be found in [device type](https://flespi.io/docs/#/gw/protocols/get_channel_protocols_channel_protocols_selector_device_types_devtypes_selector) properties or in the [protocols list](https://flespi.com/protocols).\n\nCall format: **POST /ai/tools/search-device-documentation**.\n","parameters":[{"description":"Expert consultation request","in":"body","name":"data","required":true,"schema":{"$ref":"#/definitions/search-device-documentation.post"}}],"responses":{"200":{"description":"Expert consultation response.","schema":{"$ref":"#/definitions/tool.response.text"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n"},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n"},"429":{"description":"Too many requests - ai_calls rate limit exceeded.","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Search device documentation","tags":["tools"],"x-flespi-extra-parameters":{"grant-access":"operate-as"},"x-view-group":"Experts"}},"/tools/search-flespi-documentation":{"parameters":[{"$ref":"#/parameters/cid-header"}],"post":{"description":"Ask AI expert a question about flespi platform features and configuration.\nThe expert searches flespi documentation, knowledge base articles and API specifications.\n\nFor questions that require analysis of real account data (device status, logs, configuration issues), use **/ai/tools/consult-flespi-account** instead - it has read access to account resources.\n\nThe response includes the expert's answer text and the number of credits consumed.\n\nCall format: **POST /ai/tools/search-flespi-documentation**.\n","parameters":[{"description":"Expert consultation request","in":"body","name":"data","required":true,"schema":{"$ref":"#/definitions/search-flespi-documentation.post"}}],"responses":{"200":{"description":"Expert consultation response.","schema":{"$ref":"#/definitions/tool.response.text"}},"400":{"description":"Incorrect parameters.","schema":{"$ref":"#/definitions/errors.result"}},"401":{"description":"Header \"Authorization: FlespiToken XXXXXXXX\" required.\n"},"403":{"description":"Token or customer is blocked by the platform due to variety of reasons.\n"},"429":{"description":"Too many requests - ai_calls rate limit exceeded.","schema":{"$ref":"#/definitions/errors.result"}},"500":{"description":"Server is unable to process request at the moment, try again later.\n"}},"security":[{"FlespiToken":[]}],"summary":"Search flespi platform documentation","tags":["tools"],"x-flespi-extra-parameters":{"grant-access":"operate-as"},"x-view-group":"Experts"}}},"produces":["application/json"],"schemes":["https","http"],"securityDefinitions":{"FlespiToken":{"description":"Authorization through FlespiToken","in":"header","name":"Authorization","type":"apiKey"}},"swagger":"2.0","tags":[{"description":"**Experimental**: AI agents and connectors are under active development, the API may change.\n\nAI connector types dictionary. Each type defines a specific integration available to connectors and the schema of the connector configuration field.\nA type may also declare public operations: the fields object of the agent connector assignment holds one ACL rule per operation - \"ask\", \"allow\" or \"deny\", starting from the default declared by the operation - and the operation title and arguments schema describe the approval requests the \"ask\" rule raises.\nAssign the type to the connector via its type_id field when creating the connector with [POST /ai/connectors](/docs/#/ai/connectors).\n","name":"connector-types"},{"description":"Changelog posts of the flespi AI system.\n\nTo stay current with AI and MCP updates, subscribe to 'flespi/message/ai/changelog' MQTT topic delivering any new posts published in the system [changelog](https://forum.flespi.com/t/changelog) topics on the forum.\n\nThe accumulated history of such posts is available with the 'GET /ai/changelog-posts' request. Each post carries the 'title', 'url' and 'author' of the original forum post, its 'text' in markdown, the publication 'timestamp', and the 'name' of the specific changelog it belongs to:\n\nname | changelog | posts to expect\n-----|-----------|----------------\nai | [flespi AI and MCP](https://forum.flespi.com/d/1630-changelog-flespi-ai-and-mcp) | flespi AI assistant and MCP services updates\n","name":"changelog"},{"description":"Access to AI operation logs. These endpoints are gated by the `ai` token ACL module, which also covers `ai/mcp` and `ai/tools`.\n\nAll AI operations are recorded to the [logs subsystem](/docs/#/platform/logs) with the following possible event codes:\n\nEvent code | Description\n---|---\n1700|AI tool call (REST API)\n1701|AI MCP call (all MCP server activity)\n1703|AI agent reasoning step of an [agent](/docs/#/ai/agents), one record per step attempt\n1710|AI calls were blocked\n1711|AI calls were unblocked\n\nLog entry fields (uniform shape for both 1700 and 1701):\n\nField name | Meaning\n---|---\ntimestamp   |operation start time (UNIX timestamp)\nmethod      |MCP method name (e.g. tools/call, initialize, tools/list) - empty for REST\ntool        |AI operation name (e.g. search_device_documentation, generate_pvm_code) - empty for non-tool calls\ncredits     |number of AI credits consumed\nduration    |call duration in seconds\nstatus_code |status code: 0=ok, 1=error, 2=blocked\nhost        |IP address of request origin\ntoken_id    |token ID used for authorization\ncid         |customer ID\ntrace       |request trace ID\nserver      |MCP server name - empty for REST\napp         |application identifier\narguments   |request arguments (JSON object)\nresponse    |response data\n\nThe 1703 records carry the step fields instead - timestamp, agent, step, credits, duration and reason - with the standard status codes above, plus step_code holding the detailed step status of the [agent's own log](/docs/#/ai/agents).\n\nThe [flespi AI integration](https://flespi.com/kb/flespi-ai-integration) KB article covers the AI services behind these logs.\n\nExample filter expressions for [GET /ai/logs](/docs/#/ai/logs):\n- `tool==\"search_flespi_documentation\"` - filter by tool name\n- `event_code==1701` - all MCP activity\n- `event_code==1701&&method==\"tools/call\"` - MCP tool calls only\n- `status_code==2` - blocked calls and delayed agent steps only\n- `credits>0` - only calls that consumed credits\n- `duration>10` - slow calls (over 10 seconds)\n- `event_code==1703&&agent==123` - reasoning steps of one agent\n","name":"logs"},{"description":"\n**Experimental**: AI agents are under active development, the API may change. The [flespi AI agents](https://flespi.com/kb/flespi-ai-agents) KB article gives the complete introduction.\n\nAI agents are autonomous AI entities that customers create to complete various tasks.\nEach agent serves its principal - the entity who governs the agent and whom it reports to: whoever converses with it through this API, and in Telegram or Slack the person who linked the first chat.\nAI agent capabilities are extended with assigned [connectors](/docs/#/ai/connectors), e.g. flespi or wialon_hosting.\nThe agent works in reasoning steps: within a step it reasons on the AI model, calls tools and communicates, while operations affecting external systems execute at the step boundary.\nSuch operations are guarded by the agent operations ACL assembled from the binding fields of the assigned connectors: an operation matching an \"ask\" rule creates an approval request.\nPending approval requests are listed in the \"approvals\" field of the agent (counted by \"approvals_count\") and resolved via **POST /ai/agents/{agents.selector}/approvals**, each posted resolution identified by the request timestamp: a granted operation executes right away, between reasoning steps and without consuming one, a rejected one is discarded and the agent learns the outcome with your reason.\nAn unresolved request is rejected automatically with the \"timeouted\" status once the approval window (one hour by default) passes; the expiry applies on schedule even while the agent is disabled.\nThe runtime fields are returned only when requested: check what an agent is waiting on with **GET /ai/agents/all?fields=id,name,status,approvals_count**.\nAn approval request resolved anywhere is resolved everywhere: the Telegram and Slack connectors prompt the same requests in the private chat or direct messages of the linked principal, and a decision made there clears them here as well.\nFollow the approvals live over MQTT (see the agent MQTT topics below): each pending request lives in its own retained state topic under the request timestamp formatted with six decimal places (e.g. **1786100908.214174**), carries the same approval object as the \"approvals\" field, is cleared on resolution with an empty payload and counted by the **approvals_count** state topic; the request and resolution also land in the agent log.\nCommunicate with the agent via **POST /ai/agents/{agents.selector}/messages** and follow its work with **GET /ai/agents/{agents.selector}/messages**.\nA message posted to a busy agent waits in its retained pending state topic until the agent takes it and, while still unread, can be retracted with **DELETE /ai/agents/{agents.selector}/messages/pending**.\nTrack the reading position of the chat with **POST /ai/agents/{agents.selector}/messages/read**: the posted marker lands in the **messages_read** state topic and agent field, shared by every watcher of the agent.\nThe derived **unread** flag, set while the \"updated\" time of the agent is ahead of the marker, tracks it in the **unread** state topic and agent field.\n\n###### AI credits pricing\n\nEach reasoning step costs **50 AI credits** charged against the monthly ai_credits limit of the account before the step executes. AI model usage, tool calls and operations of the step cost no extra credits - the usage details in the agent history (model, tokens, cost) are informational.\nThe charge of a failed step is automatically refunded, a cancelled step keeps the charge.\nCharged steps also count toward the per-minute ai_calls rate limit.\nWhen the charge is denied the step is delayed and retried until the charge succeeds: about once a minute, or once in 5 minutes when AI credits are exhausted; each attempt writes its own record into the agent log.\nOnce the AI credits left in the account cannot pay for one more step (fewer than 50), the platform blocks the agents of the account with block code 1 and unblocks them when the credits recover: the monthly counter resets or the limit is raised.\nA blocked agent keeps its task, memory and readable history, takes no messages or approval resolutions and starts no steps. The step running at the moment of blocking is cancelled and its charge stands (step code 6).\n\n###### Agent MQTT topics\n\nTable with the MQTT topics of the agent:\n\n  Topic | Meaning\n  -----|------\n  flespi/state/ai/agents/{agent-id}/{field}|retained runtime state field (e.g. status, approvals_count, messages_read), cleared when the agent is deleted\n  flespi/state/ai/agents/{agent-id}/approvals/{timestamp}|pending approval request retained under its request timestamp, cleared on resolution\n  flespi/state/ai/agents/{agent-id}/messages/pending/{timestamp}|message awaiting the busy agent, retained under its arrival timestamp with the history record it later lands in the feed with, restamped with the \"seen\" flag once the agent reads it and cleared on delivery or retraction\n  flespi/message/ai/agents/{agent-id}/started|reasoning step started\n  flespi/message/ai/agents/{agent-id}/executing|reasoning step heartbeat about once a second, repeats the current status\n  flespi/message/ai/agents/{agent-id}/finished|reasoning step finished with its outcome\n  flespi/message/ai/agents/{agent-id}/status|live agent status line the moment it changes\n  flespi/message/ai/agents/{agent-id}/activity|live tool activities of the working agent, one message at start and one at finish of each\n  flespi/message/ai/agents/{agent-id}/history|new history feed record\n  flespi/log/ai/agents/{agent-id}/...|agent log records from the event tables below, streamed live on their per-event topics as they happen and stored in the log\n\nThe message family is a live stream, not stored: subscribe to watch, and read the durable trail from the messages and logs endpoints.\nThe activity journal streams live too, under the log family: subscribe to **flespi/log/ai/agents/{agent-id}/execution/#** to receive every script run, received event, sent message and handler run in realtime.\n\n###### Agent logs\n\nTable with the list of existing log event codes (event_code property in log record) for agent:\n\n  Event code | Description\n  -----|------\n  1|agent was created via REST API\n  2|agent was updated via REST API\n  3|agent was deleted via REST API\n  20|agent was blocked, see [customer](/docs/#/platform/customer) for more information\n  21|agent was unblocked, see [customer](/docs/#/platform/customer) for more information\n  1720|connector was assigned to agent\n  1721|connector was unassigned from agent\n  1730|AI agent step, records the step charges and outcomes - see the tables below\n  1731|AI agent approval requested, an operation awaits your decision - see the fields below\n  1732|AI agent approval resolved, the outcome is in the resolution_code record field - see the tables below\n  1733|AI agent script execution, records a computation the agent ran - see the tables below\n  1734|AI agent event received, an inbound event reached the agent - see the tables below\n  1735|AI agent message sent, the agent messaged outward - see the tables below\n  1736|AI agent event handler execution, a background event handler ran - see the tables below\n\nEvery call the agent makes on a connected system is recorded into the logs of the called [connector](/docs/#/ai/connectors).\n\nFields of the 1730 log record:\n\n  Field name | Meaning\n  -----|------\n  timestamp|step record time (UNIX timestamp)\n  step_code|step outcome, see the table below\n  credits|net AI credits charged for the step\n  step|number of the reasoning step the record belongs to\n  duration|step duration in seconds, present in completed step records\n  reason|provider failure reason, present in the LLM provider failure records (step code 2)\n\nStep codes of the AI agent step records (step_code property in the 1730 log record):\n\n  Step code | Description\n  -----|------\n  0|completed successfully\n  1|failed due to internal error, the charge is refunded\n  2|failed due to LLM provider error, the charge is refunded\n  3|delayed, AI credits exhausted\n  4|delayed, AI credits charge could not be processed\n  5|delayed, AI calls rate limited\n  6|cancelled, the agent was disabled, blocked or deleted during the step, the charge stands\n\nFields of the 1731 and 1732 approval log records:\n\n  Field name | Meaning\n  -----|------\n  timestamp|record time (UNIX timestamp)\n  approval|approval request id, the timestamp of the approval request\n  type|operation type, its arguments schema is declared by the connector type providing the operation\n  title|short human-readable summary of the operation\n  resolution_code|resolution code, present in the 1732 records - see the table below\n  reason|rejection reason, present in the rejected and timeouted resolution records\n\nResolution codes of the approvals (resolution_code property in the 1732 log record):\n\n  Resolution code | Description\n  -----|------\n  0|granted, the operation executes\n  1|rejected, the operation is discarded\n  2|rejected by the approval timeout\n\nFields of the 1733 script execution records, one record per computation script the agent ran:\n\n  Field name | Meaning\n  -----|------\n  timestamp|execution start time (UNIX timestamp)\n  name|script label chosen by the agent, when set\n  purpose|what the script accomplishes, as stated by the agent\n  execution_code|execution outcome, see the table below\n  duration|execution duration in seconds\n  step|reasoning step that ran the script\n\nOutcome codes of the script execution records (execution_code property in the 1733 log record):\n\n  Execution code | Description\n  -----|------\n  0|completed successfully\n  1|failed, the script raised an error\n\nFields of the 1734 received event records, one record per inbound event accepted by the agent:\n\n  Field name | Meaning\n  -----|------\n  timestamp|event arrival time (UNIX timestamp), matches the record of this event in the agent history\n  type_code|event type, see the table below\n  source|surface the event arrived from matching the type_code, see the sources table below\n  name|event author or sender display name, when the event carries one\n  text|event text, when the event carries one\n  step|reasoning step that consumed the event, when already assigned at arrival\n\nEvent types of the received event records (type_code property in the 1734 log record):\n\n  Type code | Description\n  -----|------\n  0|principal message received\n  1|email received\n  2|Telegram message received\n  3|Telegram chat linked\n  4|Telegram chat unlinked\n  5|Slack message received\n  6|Slack channel linked\n  7|Slack channel unlinked\n\nFields of the 1735 sent message records, one record per message the agent produced toward its environment:\n\n  Field name | Meaning\n  -----|------\n  timestamp|message delivery time (UNIX timestamp), matches the record of this message in the agent history\n  channel_code|message channel, see the table below\n  source|surface the message left through matching the channel_code, see the sources table below\n  name|channel-native recipient (chat, channel, addresses), absent for the principal chat\n  title|message subject, when the channel has one (e.g. email)\n  text|communicated text\n  step|reasoning step that produced the message\n\nChannels of the sent message records (channel_code property in the 1735 log record):\n\n  Channel code | Description\n  -----|------\n  0|message to the principal\n  1|Telegram message sent\n  2|Slack message sent\n  3|email sent\n\nSources of the received event and sent message records (source property in the 1734 and 1735 log records):\n\n  Source | Meaning\n  -----|------\n  principal|the agent's own chat on this API\n  telegram|a linked Telegram chat\n  slack|a linked Slack channel or direct message\n  email|the connected email account\n\nFields of the 1736 event handler execution records, one record per background handler run:\n\n  Field name | Meaning\n  -----|------\n  timestamp|run start time (UNIX timestamp)\n  run_code|run outcome, see the table below\n  name|handler id\n  source|trigger that fired the handler\n  duration|run duration in seconds\n\nOutcome codes of the event handler execution records (run_code property in the 1736 log record):\n\n  Run code | Description\n  -----|------\n  0|completed silently\n  1|completed, woke the agent\n  2|completed, the handler was removed\n  3|failed, the handler was removed\n","name":"agents"},{"description":"\n**Experimental**: AI connectors are under active development, the API may change.\n\nAI connectors extend [AI agent](https://flespi.com/kb/flespi-ai-agents) capabilities with specific integrations, e.g. flespi or wialon_hosting.\nThe [Telegram](https://flespi.com/kb/telegram-ai-agent-connector), [Slack](https://flespi.com/kb/slack-ai-agent-connector), [email](https://flespi.com/kb/email-ai-agent-connector), [Wialon Hosting](https://flespi.com/kb/wialon-hosting-ai-agent-connector) and [Teltonika FOTA WEB](https://flespi.com/kb/teltonika-fota-web-ai-agent-connector) connector types are covered in dedicated KB articles.\nEach connector is created from a connector type that you can retrieve with [GET /ai/connector-types/all](/docs/#/ai/connector-types) API call.\nThe connector type defines the schema of the connector configuration field.\nConnectors are assigned to agents with [POST /ai/agents/{agents.selector}/connectors/{agent.connectors.selector}](/docs/#/ai/agents) API call.\nOptional binding fields of the assignment assemble the agent operations ACL: each field names an operation declared by the connector type (see its operations map) and holds its rule - \"ask\" creates an approval request the agent awaits in its \"approvals\" field (see [agents](/docs/#/ai/agents)), \"allow\" auto-executes, \"deny\" rejects immediately.\nOmitted fields take the default rule declared by the operation.\nThe connector item_schema field serves the JSON schema of the binding fields, ready to render the ACL form of an assignment.\nReplace the rules of an existing assignment with [PUT /ai/agents/{agents.selector}/connectors/{agent.connectors.selector}](/docs/#/ai/agents) carrying the new binding fields.\n\n###### Connector logs\n\nThe log records also stream live over MQTT: the call records on **flespi/log/ai/connectors/{connector-id}/calls/read** and **.../calls/mutation**, the lifecycle records on their per-event topics.\n\nTable with the list of existing log event codes (event_code property in log record) for connector:\n\n  Event code | Description\n  -----|------\n  1|connector was created via REST API\n  2|connector was updated via REST API\n  3|connector was deleted via REST API\n  20|connector was blocked, see [customer](/docs/#/platform/customer) for more information\n  21|connector was unblocked, see [customer](/docs/#/platform/customer) for more information\n  1800|flespi connector read\n  1801|flespi connector mutation\n  1805|Wialon Hosting connector read\n  1806|Wialon Hosting connector mutation\n  1810|Email connector read\n  1811|Email connector mutation\n  1816|Telegram connector mutation\n  1821|Slack connector mutation\n  1825|Teltonika FOTA WEB connector read\n  1826|Teltonika FOTA WEB connector mutation\n\nFields of the connector call records (the event codes listed above), one record per call an [agent](/docs/#/ai/agents) makes on the connected system:\n\n  Field name | Meaning\n  -----|------\n  timestamp|call start time (UNIX timestamp)\n  agent|id of the agent that made the call\n  connector|connector type of the called system\n  operation|connector-native verb: HTTP method, Wialon svc, bot API method, send, fetch and similar\n  target|connector-native address: URI, mailbox, chat or channel id, recipients, when the operation addresses something\n  account|sub-context within the connected system, e.g. the flespi subaccount of the call\n  params|request payload or arguments: an object, or its truncated string rendering when oversized\n  attachments|attached files summary as entries carrying the name and, when known, size and mime, never the content\n  mutate|true for mutating calls, false for reads\n  result_code|call outcome, see the table below\n  reason|failure detail, present in failed call records\n  duration|call duration in seconds\n  count|items returned, when countable\n  step|reasoning step of the agent that produced the call, absent for background calls\n  source|call origin: script, operation, or watcher\n  operation_id|step-boundary operation id, matches the approval field of the approval log records of the calling agent\n\nResult codes of the connector call records (result_code property in the connector call log records, following the flespi REST result code convention; connectors map native failures onto the nearest code, the native detail stays in the reason field):\n\n  Result code | Description\n  -----|------\n  0|completed successfully\n  1|failed, the connected system reported a server error\n  2|rejected as a bad request\n  3|rejected, access denied\n  4|rejected, the connection credentials are not authorized\n  5|rejected by a rate limit\n  6|accepted, processing continues\n  7|failed to reach the connected system\n  8|rejected as a conflict\n","name":"connectors"},{"description":"[MCP](https://modelcontextprotocol.io/) (Model Context Protocol) servers provide AI agents with tools to interact with flespi - search documentation, discover and call REST API methods, generate PVM code, and more. Client setup examples live in the [flespi AI integration](https://flespi.com/kb/flespi-ai-integration) KB article.\n\n**Available servers:**\n- **develop** - for development agents building applications on top of flespi. Instructions cover platform entities (channels, devices, streams, calculators, plugins, containers, webhooks), API namespaces, and message parameters.\n- **support** - for support agents diagnosing customer issues, with built-in diagnostic patterns (connectivity checks, data gap analysis, stream failures, permission errors) and investigation guidance.\n\n**Tools available:**\n\nTool | Credits | Description\n---|---|---\nsearch-api-methods|0|discover flespi REST API methods by natural language query\napi-method-schema|0|retrieve full Swagger schema for a specific API method\nflespi-api-read|0|execute a read-only GET request to the flespi REST API\nflespi-api-write|0|execute a write operation (POST/PUT/PATCH/DELETE) on the flespi REST API\nsearch-flespi-documentation|5|search flespi platform documentation\nsearch-device-documentation|10|search device/protocol manufacturer documentation\nconsult-flespi-account|30|delegate complex analysis to a flespi platform expert with account read access\ngenerate-pvm-code|10|generate PVM code from a task description\ngenerate-flespi-expression|2|generate flespi expressions for selectors, calculators, webhooks, plugins, streams\n\ngenerate-pvm-code is available on the develop server only, search-device-documentation on the support server only.\n\nTools that cost credits also count toward the per-minute ai_calls rate limit. See [/ai/tools](/docs/#/ai/tools) for individual tool documentation.\n\n##### Token security\n\n- For realm users, prefer connecting [through a realm](https://flespi.com/kb/realm-mcp-connect-ai-agents): access is authorized via the realm sign-in and no token is shared with the client.\n- Create a dedicated [ACL token](https://flespi.com/kb/tokens-access-keys-to-flespi-platform) with `POST ai/mcp` plus the downstream API sections the agent will touch (e.g., `gw/devices`, `gw/channels`, `storage/containers`) - `flespi-api-read`, `flespi-api-write`, and `consult-flespi-account` are checked against the actual paths they call.\n- The `ai` module covers `ai/mcp` and `ai/tools` as well.\n- For read-only agents: grant only `GET` on the downstream sections.\n- Avoid providing [Master or Standard tokens](https://flespi.com/blog/take-control-of-token-access-permissions-with-flexible-acls) to AI agents - these grant broad access that cannot be restricted per-method.\n- Set a reasonable TTL (expiration time) on the token.\n- Review token permissions before sharing: [GET /auth/info](/docs/#/auth/utils/get_info) returns the current token's access configuration.\n\nTo create an ACL token, use [POST /platform/tokens](/docs/#/platform/tokens/post_tokens) with `access.type = 2` and an `acl` array. See [ACL token documentation](https://flespi.com/blog/take-control-of-token-access-permissions-with-flexible-acls) for details.\n\n##### Setup\n\n**Claude Code:**\n```\nclaude mcp add flespi \"https://flespi.io/ai/mcp/develop\" \\\n  -t http -H \"Authorization: FlespiToken <YOUR_TOKEN>\"\n```\n\n**Generic MCP client config (JSON):**\n```json\n{\n  \"mcpServers\": {\n    \"flespi\": {\n      \"type\": \"http\",\n      \"url\": \"https://flespi.io/ai/mcp/develop\",\n      \"headers\": {\n        \"Authorization\": \"FlespiToken <YOUR_TOKEN>\"\n      }\n    }\n  }\n}\n```\n\nReplace `develop` with `support` for the support agent server.\n\nRealm users can connect OAuth-capable MCP clients without a token through the realm MCP endpoints `/realm/{realm-public-id}/ai/mcp/develop` and `/realm/{realm-public-id}/ai/mcp/support` - see [connect AI agents to flespi through a realm](https://flespi.com/kb/realm-mcp-connect-ai-agents).\n","name":"mcp"},{"description":"Stateless AI tools accessible via REST API. Each tool is an independent endpoint - call from scripts, CI/CD, or use as building blocks for AI integrations.\n\nUnlike [MCP servers](/docs/#/ai/mcp) which provide a full agent experience with built-in instructions and flespi API execution, tools are simple request-response endpoints - you control context and orchestration. See [flespi AI integration](https://flespi.com/kb/flespi-ai-integration) in the KB for the integration guide.\n\n**Available tools:**\n\nTool | Credits | Description\n---|---|---\nsearch-api-methods|0|discover flespi REST API methods by natural language query\napi-method-schema|0|retrieve full Swagger schema for a specific API method\nsearch-flespi-documentation|5|search flespi platform documentation\nsearch-device-documentation|10|search device/protocol manufacturer documentation\nconsult-flespi-account|30|delegate complex analysis to a flespi platform expert with account read access\ngenerate-pvm-code|10|generate PVM code from a task description\ngenerate-flespi-expression|2|generate flespi expressions for selectors, calculators, webhooks, plugins, streams\n\n**Response format:** All tools return `{result, credits}` - the result (text or structured data) and AI credits consumed.\n\n**API discovery workflow:** Use `search-api-methods` to find relevant endpoints by natural language query, then `api-method-schema` to retrieve full Swagger schema with parameters, fields, and selectors. Both are free and instant - use them liberally.\n\n**Credits and rate limiting:** Paid tools consume from your monthly AI credits budget and count toward the per-minute `ai_calls` rate limit. When credits are exhausted the API returns HTTP 403; when the rate limit is exceeded - HTTP 429. Credit usage is visible in [/ai/logs](/docs/#/ai/logs).\n\n**Token security:** The `/ai/tools/*` endpoints are ACL-gated at the `ai/tools` module level - include `GET ai/tools` (for `search-api-methods` and `api-method-schema`) and/or `POST ai/tools` (for the rest) in the ACL token. The `ai` module covers `ai/mcp` and `ai/tools` as well. The same tools reached through [MCP](/docs/#/ai/mcp) are gated by `POST ai/mcp` instead. `consult-flespi-account` additionally reads the caller's account under the same token's ACL, so include the gateway/platform sections the expert needs. Master and Standard tokens cover all tool paths automatically.\n","name":"tools"}]}