sources
Sources API. Sources allow you to store your data.
GET /api/v2/workspace/{workspaceId}/sources
Obtains the list of data sources
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Autentication token
|
page | query | integer (int32) | Requested page (starts with 0)
|
limit | query | integer (int32) | Max number of items per page (max 500)
|
field_type | query | string: date | numeric | nominal | logic | text | Optional: only the sources with at least one field of this type (date lists the sources a forecast can use). The answer then also has field_type and total_sources, the number of sources of the workspace.
|
响应
- 200 Normal response. Paginated result.
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/sources" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/sources
Creates a new data source
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
name | string | Source name. Max 120 characters.
|
description | string | Source description. Max 300 characters.
|
encrypted | boolean | True to encrypt the data source
|
shuffled | boolean | True to shuffle instances
|
features | array<object> | List of features to create
|
响应
- 200 Normal response.
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/sources" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/clone
Clones Source
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
name | string | Source name (Max 120 characters)
|
响应
- 200 Success
- 400 Bad request
- 401 Unauthorized
- 403 Access denied
- 404 Not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/clone" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/sources/derived
Creates a derived source
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
name | string | Source name. Max 120 characters.
|
description | string | Source description. Max 300 characters.
|
derived_type | string: filter | extend | join | merge | aggregate | join_multi | recipe | text_analysis | Derived type. filter = Filters a source. extend = Melts a source. join = Join 2 sources. merge = merges 2 sources. aggregate = Performs instances aggregations. join_multi = Joins a main source with 1 to 5 more (main, lookups and columns): the lookups are loaded in memory up to the cap of the plan (JOIN_TOO_BIG above it), a repeated key of a lookup uses its first row, and each run keeps a report (GET .../source/{sourceId}/join-report). recipe = a prepared source: the steps over the origin, recomputed each time the origin updates (see GET .../source/{sourceId}/recipe). text_analysis = «Analizar textos»: the columns of the origin plus a classical analysis of one of its columns of texts (origin, column, tasks, language, keywords_top, date_column, topics, classifiers, names), applied again when the origin updates when the plan includes it (see GET .../source/{sourceId}/text-analysis); refused with TEXT_ANALYSIS_LIMIT or TEXT_ANALYSIS_PLAN by the caps of the plan and TEXT_ENGINE_OUTDATED when the AI module cannot analyse texts. image_analysis = «Analizar imágenes»: the columns of the origin plus image_status and the columns of an objective over its image column (origin, column, objective, auto_refresh); see POST .../source/{sourceId}/images/analyze
|
origin | string | ID of the origin source.
|
origin_b | string | ID of the second origin source. For join and merge.
|
query | QueryTree | Tree used to describe a query. Used in order to query instances of data sources.
|
features | string | List of features indexes, split by commas. For filter, this selects the list of features to keep in the derived source. For extend, this selects the features to melt.
|
steps | array<RecipeStep> | recipe: the steps, checked against the columns of the origin (400 with the code of the first one that cannot be used)
|
column | string | text_analysis: NAME of the column of texts (text or nominal)
|
tasks | array<string: language | sentiment | keywords | entities | topics> | text_analysis: what to compute (default language, sentiment, keywords); entities on the plans that include them
|
language | string | text_analysis: auto (default: identified in each text) or es, en, ca, de, fr, it, pt, ja, zh
|
keywords_top | integer | text_analysis: keywords per text (default 5)
|
date_column | string | text_analysis: NAME of a column of dates: sentiment (and topics, on the plans with topics over time) by period
|
topics | object | text_analysis with the task topics: {k: 0 (automatic) or 2 to the maximum of the plan, method?: nmf or lda, model?: an existing topics model of the workspace}
|
classifiers | array<object> | text_analysis: text classifiers of the workspace to apply ({model, column, kind: emotions or labels}); own classifiers on the plans that include them
|
names | object | text_analysis: names of the new columns by output (language, sentiment, score, keywords, entities, people, topic, topic_weight); a name taken by the origin gets « 2»
|
field_a | number (int32) | Match feature for join in first origin source. For merge, this sets the source name filed if the first source is already a merge source. For aggregate, this is the field to group by, set to -1 for no grouping.
|
field_b | number (int32) | Match feature for join in the second origin source.
|
encrypted | boolean | True to encrypt the data source
|
shuffled | boolean | True to shuffle instances
|
main | string | join_multi: identifier of the main source (one output row per row of it, or fewer with inner lookups)
|
lookups | array<JoinMultiLookup> | join_multi: the sources joined to the main one, in order
|
columns | array<JoinMultiColumn> | join_multi: the columns of the new source, in order (default: every column of the main source and of each lookup without its key columns)
|
响应
- 200 Normal response.
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/sources/derived" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/sources/external
Creates an external source
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
name | string | Source name. Max 120 characters.
|
description | string | Source description. Max 300 characters.
|
url | string | External connection URL
|
features | array<object> | List of features to create
|
响应
- 200 Normal response.
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/sources/external" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/sources/real_time
Creates a real time source
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
name | string | Source name. Max 120 characters.
|
description | string | Source description. Max 300 characters.
|
max_age | number (int64) | Max age of registers in milliseconds. Set to 0 or negative for unlimited age. It can never be longer than the maximum age of the plan of the organization: a longer age (or 0) is shortened to it.
|
features | array<object> | List of features to create
|
响应
- 200 Normal response.
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/sources/real_time" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/sources/other
Creates other type of source. Including database sources or MQTT sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
name | string | Source name. Max 120 characters.
|
description | string | Source description. Max 300 characters.
|
type | string: file/any | url/any | s3 | ckan | database/mongo | database/mysql | database/influx | mqtt | |
encrypted | boolean | True to encrypt the data source
|
shuffled | boolean | True to shuffle instances
|
indexed | boolean | True to index the fields
|
dyn_enabled | boolean | Set to true to enable auto update
|
dyn_delay | number (int64) | Auto update delay (milliseconds). Min is 5 minutes.
|
dyn_replace | boolean | Set to true to replace the entire data set with each update. False to append the data.
|
dyn_pk | string | Name of the primary key field. In order to check for duplicates when appending.
|
dyn_update_mode | boolean | Set to true to update existing rows (by primary key). Set to false to skip duplicate rows. If you set dyn_replace to true. This option does not have any effect.
|
file | string | File (multipart/form-data) for file/any (required)
|
file_name | string | Name of the uploaded file
|
separator | string | Separator character for csv files
|
quotes | string | Quotes character for csv files
|
csv_header | boolean | Set to false if the csv files does not have a header.
|
json_fields | array<string> | List of fileds to get, in order, for json files or mongo databases.
|
json_prefix | string | Prefix to tell the engine where the data is in the JSON file. Use dots to split levels.
|
json_mode | string: single | default | Set to single in case there is a single instance in the JSON
|
date_format | string | Date format in the CSV of JSON file. By default is the ISO format. This uses the Moment.js formats.
|
url | string | URL for url/any and ckan source types. In case of S3. This is the URI of the object inside the bucket. For mongo and influx, this is the connection URL.
|
parser | string: auto | csv | json | jsonl | parquet | xlsx | ods | sqlite | File format: 'auto' (or empty) detects it from its content, content type and name; or one of csv, json, jsonl (JSON Lines), parquet, xlsx (Excel, also XLS), ods, sqlite. Share links of Google Sheets, Google Drive, OneDrive, SharePoint and Dropbox are downloaded as the file they point to.
|
sheet | string | Sheet of a spreadsheet (xlsx, ods, Google Sheets) to read, by the name on its tab. Empty: the first one.
|
http_headers | string | Custom headers to send
|
rejectUnauthorized | boolean | Set to false to ignore invalid certificates: of the HTTPS server (url/any), or of a Microsoft SQL Server (database/mysql with db = ms, for a self-signed certificate). Default true.
|
sdp_enabled | boolean | Set to true to enable stored data parameter in the Query. Any instances of ${SDP} will be replaced.
|
sdp_name | string | Name of the field to use for SDP
|
sdp_dir | string: desc | asc | Sorting direction to calc the SDP
|
database | string | Name of the database or the S3 bucket.
|
user | string | User / Access key ID
|
password | string | Password / Secret key
|
table | string | Name of the table / collection
|
query | string | Database Query. For mongo, this is a JSON.
|
sort | string | For MongoDB. Sorting
|
project | string | MongoDB project.
|
limit | number (int32) | Limit of results
|
db | string: mysql | pg | oracle | ms | Database type (for relational)
|
host | string | Database host. For Microsoft SQL Server (db = ms) it can also be server\INSTANCE (a named instance, found through the SQL Server Browser), server,port or tcp:server,port.
|
port | number (int32) | Port number
|
topics | string | For MQTT, list of topics split by commas.
|
fields_expected | array<object> | List of expected fields for MQTT
|
响应
- 200 Normal response.
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/sources/other" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/source/{sourceId}
Obtains information about a source
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Autentication token
|
catalog | query | string: true | false | true: adds catalog, the catalogue of the source as GET .../catalog gives it (only to a member who can read the sources). Without it the answer is the same as always.
|
响应
- 200 Normal response.
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/source/{sourceId}
Sets the name and description of the source
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
name | string | Source name (max 120 characters)
|
description | string | Source description (max 300 characters)
|
响应
- 200 Normal response.
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
DELETE /api/v2/workspace/{workspaceId}/source/{sourceId}
Deletes the data source
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Autentication token
|
响应
- 200 Normal response.
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X DELETE "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/dependents
Dependency map of a source: what is built from it, to check before editing or deleting it.
derived: its derived sources as a tree (how: filter, join, merge, extend (melt), aggregate, or model for the predictions of a model applied to it), followed down to 6 levels; deeper counts the sources one level beyond.
models, visualizations and alerts (the simple notices): those built on the source or on one of its derived sources (direct is false for the latter, and source says which).
dashboards: those that show one of those visualizations, a widget of one of those models, or use the source or a derived source in a monitor, a filter or a variable input (via).
Each kind lists up to 50 items, direct ones first; more counts the rest and partial marks a count cut by a safety limit. Groups the user of the token cannot read in the workspace (read_sources, read_models, read_views, read_dashboards) keep their count, with hidden: true and no items. A public source does not make its map public: the token is always required.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Autentication token
|
响应
- 200 Normal response.
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/dependents" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/connection
Gets external source connection URL
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Autentication token
|
响应
- 200 Normal response.
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/connection" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/connection
Sets the Connection for a external source
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
url | string | External connection URL
|
响应
- 200 Normal response.
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/connection" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/real_time
Gets real time connection details and configuration
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Autentication token
|
响应
- 200 Normal response.
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/real_time" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/real_time
Updates real time configuration
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
max_age | number (int64) | Max age of registers in milliseconds. Set to 0 or negative for unlimited. It can never be longer than the maximum age of the plan of the organization: a longer age (or 0) is shortened to it.
|
regenerate_password | boolean | Set to true to regenerate the MQTT password. Use if it was compromised.
|
响应
- 200 Normal response.
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/real_time" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/real_time_push
Inserts an instance in real time. Alternative to MQTT for slower inserts.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
data | array<string> | Array of data fields. This does not include the timestamp or the computed fields
|
响应
- 200 Normal response.
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/real_time_push" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/real_time_clear
Clears instances of a real time source to fit into limits.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
from_time | number (int64) | Timestamp (Unix millis). Start of the clear range
|
to_time | number (int64) | Timestamp (Unix millis). End of the clear range
|
响应
- 200 Normal response.
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/real_time_clear" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/autoupdate
Gets source auto update configuration
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Autentication token
|
响应
- 200 Normal response.
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/autoupdate" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/autoupdate
Sets the auto update configuration
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
dyn_enabled | boolean | Set to true to enable auto update
|
dyn_delay | number (int64) | Auto update delay (milliseconds). Min is 5 minutes.
|
dyn_replace | boolean | Set to true to replace the entire data set with each update. False to append the data.
|
dyn_pk | string | Name of the primary key field. In order to check for duplicates when appending.
|
dyn_update_mode | boolean | Set to true to update existing rows (by primary key). Set to false to skip duplicate rows. If you set dyn_replace to true. This option does not have any effect.
|
separator | string | Separator character for csv files
|
quotes | string | Quotes character for csv files
|
csv_header | boolean | Set to false if the csv files does not have a header.
|
json_fields | array<string> | List of fileds to get, in order, for json files or mongo databases.
|
json_prefix | string | Prefix to tell the engine where the data is in the JSON file. Use dots to split levels.
|
json_mode | string: single | default | Set to single in case there is a single instance in the JSON
|
date_format | string | Date format in the CSV of JSON file. By default is the ISO format. This uses the Moment.js formats.
|
url | string | URL for url/any and ckan source types. In case of S3. This is the URI of the object inside the bucket. For mongo and influx, this is the connection URL.
|
parser | string: auto | csv | json | jsonl | parquet | xlsx | ods | sqlite | File format: 'auto' (or empty) detects it from its content, content type and name; or one of csv, json, jsonl (JSON Lines), parquet, xlsx (Excel, also XLS), ods, sqlite. Share links of Google Sheets, Google Drive, OneDrive, SharePoint and Dropbox are downloaded as the file they point to.
|
sheet | string | Sheet of a spreadsheet (xlsx, ods, Google Sheets) to read, by the name on its tab. Empty: the first one.
|
http_headers | string | Custom headers to send
|
rejectUnauthorized | boolean | Set to false to ignore invalid certificates: of the HTTPS server (url/any), or of a Microsoft SQL Server (database/mysql with db = ms, for a self-signed certificate). Default true.
|
sdp_enabled | boolean | Set to true to enable stored data parameter in the Query. Any instances of ${SDP} will be replaced.
|
sdp_name | string | Name of the field to use for SDP
|
sdp_dir | string: desc | asc | Sorting direction to calc the SDP
|
database | string | Name of the database or the S3 bucket.
|
user | string | User / Access key ID
|
password | string | Password / Secret key
|
table | string | Name of the table / collection
|
query | string | Database Query. For mongo, this is a JSON.
|
sort | string | For MongoDB. Sorting
|
project | string | MongoDB project.
|
limit | number (int32) | Limit of results
|
db | string: mysql | pg | oracle | ms | Database type (for relational)
|
host | string | Database host. For Microsoft SQL Server (db = ms) it can also be server\INSTANCE (a named instance, found through the SQL Server Browser), server,port or tcp:server,port.
|
port | number (int32) | Port number
|
topics | string | For MQTT, list of topics split by commas.
|
fields_expected | array<object> | List of expected fields for MQTT
|
响应
- 200 Normal response.
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/autoupdate" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/features
Transforms the source features. If you change the types, all the instances will be casted to the selected types.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
shuffled | boolean | True to add a hidden feature to shuffle instances
|
features | array<object> | List of features mapped to the previous features
|
响应
- 200 Normal response.
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/features" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/analyze
Talk to your data: exact figures over ALL the rows of a source, computed by AIR-Core on the server (never by a language model). Counts, distinct values, sums, averages, minimums, maximums and medians, grouped by up to 2 fields (dates by hour, day, week, month, quarter or year in the time zone of the question), with filters, relative periods resolved on the server, top N, share of the total and comparison with the previous period or the same period a year before. Reads at most the rows of the installation limit (2,000,000 by default) for a limited time (25 s by default): read.partial says whether the figures cover only part of the rows. Changes nothing. Requires the read_sources permission. On the free plan it needs the organization's own AI key (403 TALK_PLAN_REQUIRED).
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
metric | string: count | count_distinct | sum | avg | min | max | median | What is computed. count (default) counts rows, or the non-empty values of field; sum, avg and median need a numeric field; min and max a numeric or date field.
|
field | string | integer | Field measured, by name or index.
|
group_by | array<string | integer | object> | Up to 2 fields to group by, by name or index, or as {field, bucket}. Date fields are grouped by bucket: hour, day, week (from Monday), month (default), quarter or year.
|
filters | array<object> | Conditions that must all hold: {field, op, value}. op: eq (default), not_eq, in (value is a list), gt, gte, lt, lte, cn, cni, sw, swi, ew, ewi or null. A category value written with other capitals or accents is matched to the value of the data, and the answer says so in notes.
|
where | object | Advanced filter (QueryTree, as in the queries of instances), combined with filters. left may also be a field name.
|
period | object | Period of a date field (by default, the first date field), resolved on the server in the time zone: a preset (today, yesterday, this_week, last_week, this_month, last_month, this_quarter, last_quarter, this_year, last_year, last_7_days, last_30_days, last_90_days, last_12_months or last_N_days, weeks, months or years; this_* runs up to now), last N units (the current one included), or from and to, both included (YYYY, YYYY-Qn, YYYY-MM, YYYY-MM-DD or YYYY-MM-DDTHH:mm).
|
compare | string: previous_period | previous_year | Compare with the previous period (of the same length; this_* with the same stretch of the previous unit) or with the same period a year before. Needs period. Adds previous, change and change_pct.
|
order | string: desc | asc | label | label_desc | desc: largest value first (default); asc; label: by name, or in date order (default when grouping by a date); label_desc.
|
limit | integer | Groups returned (top N). 50 by default; the maximum is the installation limit (200 by default).
|
timezone | string | IANA time zone of the question (UTC by default).
|
响应
- 200 The figures as AIR-Core computed them. columns describes each position of rows: the group values (g0, g1; date groups as keys such as 2026-03, 2026-Q1, 2026-03-02 for the week of that Monday), value, and share, previous, change and change_pct when they apply. total has the value over all the rows that match; groups.other adds up the groups not returned (counts and sums). read says how many rows were read and whether the read was partial. explanation says how it was computed, in English.
- 400 Bad question: BAD_REQUEST, BAD_METRIC, BAD_FIELD (details.fields lists the fields), FIELD_REQUIRED, FIELD_NOT_NUMERIC, TOO_MANY_GROUPS, BAD_FILTER, BAD_PERIOD, DATE_FIELD_REQUIRED, DATE_FIELD_NOT_DATE, BAD_COMPARE, COMPARE_NEEDS_PERIOD, TOO_MANY_GROUP_VALUES or EMPTY_SOURCE, with a message.
- 401 Invalid authorization
- 403 No permission, or TALK_PLAN_REQUIRED: on the free plan it needs the organization's own AI key.
- 404 Workspace or source not found
- 429 Too many questions in a minute (TOO_MANY_REQUESTS).
- 503 SOURCE_UNAVAILABLE: the data could not be read now (an external source whose connector does not answer).
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/analyze" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/instances
Queries the instances of a data source
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Autentication token
|
select | query | string | List of features (indexes to fetch). Do not set to get all the features.
|
where | query | string | Conditions to match (filter), as a JSON of QueryTree (see schemas for more information)
|
order_by | query | string | Sorting options. Must be the index of the feature to sort by and 'asc' or 'desc'.
|
offset | query | integer (int32) | Number of instances to skip (if you orderred them)
|
limit | query | integer (int32) | Max number of instances to fetch. Do not set or set to -1 to get all the instances.
|
响应
- 200 Normal response.
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/instances" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/instances
Updates a data source.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
replace | boolean | True in order to replace the dataset with the provided data, false in order to append the provided data.
|
pk | string | Private key (optional) to use to orevent duplicates
|
date_format | string | Date formatting to use. ISO by default
|
data | array<array<string>> | Data to provide, as a matrix
|
响应
- 200 Normal response.
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/instances" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
DELETE /api/v2/workspace/{workspaceId}/source/{sourceId}/instances
Updates a data source.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Autentication token
|
where | query | string | Conditions to match (filter), as a JSON of QueryTree (see schemas for more information)
|
响应
- 200 Normal response.
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X DELETE "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/instances" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/external/source/update
Updates an external source, so that its automations run and its cache is cleared. You can include up to 100 instances to analize in the body.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
x-public-key 必填 | header | string | External source public key
|
x-secret-key 必填 | header | string | External source secret key
|
请求正文 application/json
array<array<string | number | boolean>>
响应
- 200 Normal response.
- 429 Busy. You will receive this response by trying to update with multiple requests in parallel.
示例
curl -X POST "https://app.air-core.io/api/v2/external/source/update" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/catalog
The catalogue of a data source («Ficha»): what its data mean. The description, the person in charge (steward), tags and provenance (origin and update process written by people, the sources of the workspace it is obtained from, and what AIR-Core knows in computed: kind of origin, automatic updates, parent sources and model). Per field, in the order of the source: description, unit, kind of value (semantic_type), allowed values or range (informative) and its personal data, the one found and chosen in the AI governance (never changed here). ai_withheld lists the texts an AI would not receive because the detector of personal data finds some in them. An AI application connected through MCP (and the built-in assistant) gets it as an AI may see it: never the person in charge nor who saved it, the flagged texts empty and listed in withheld_for_ai, no allowed values nor ranges below the level «aggregates» of the AI data policy, and personal_data as not_sent, pseudonymised or allowed. Needs a token that reads workspaces and permission to read the sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 The catalogue (empty values when the source has none)
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or source not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/catalog" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
PUT /api/v2/workspace/{workspaceId}/source/{sourceId}/catalog
Changes the catalogue of a data source. Only the keys sent change: an empty text, null or an empty list clears a value, and null for a field clears its whole entry. fields is an object by field name or a list of entries with name or index. Unknown keys or fields, texts too long and kinds of value that do not exist are refused (400), never cut. provenance.derived_from names other sources of the same workspace. The data of the source and its personal data choices are not changed. Needs a token that writes workspaces and permission to edit the source (or to own it). Answers the catalogue as GET does.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
description | string | |
steward | string | |
tags | array<string> | |
provenance | object | |
fields | object | array<SourceCatalogFieldChange> | By field name ({"importe": {...}}) or a list of entries with name or index ([{"index": 2, ...}])
|
响应
- 200 The catalogue as it is left
- 400 BAD_REQUEST, UNKNOWN_KEY, UNKNOWN_FIELD (details.fields), BAD_FIELD_ENTRY, BAD_SEMANTIC_TYPE, BAD_RANGE, BAD_DESCRIPTION, BAD_UNIT, BAD_TAGS, BAD_STEWARD, BAD_ORIGIN, BAD_UPDATE_PROCESS, BAD_ALLOWED_VALUES, BAD_DERIVED_FROM or BAD_PROVENANCE
- 401 Invalid authorization
- 403 Access denied (ACCESS_DENIED: without permission to edit the source), or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or source not found
示例
curl -X PUT "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/catalog" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/sources/join/suggest
Suggested keys to join a main data source with 1 to 5 other sources of the workspace (for a join of several sources, derived_type join_multi). For each lookup, up to 5 pairs of columns ordered by confidence: by names and types (the join the data advisor proposes, the same name), by the catalogue of both sources when it says something (the same kind of value helps; different kinds of value or units count against and are noted) and by the values in common measured on samples: overlap is the share of the first 1000 rows of the main source whose value is in the lookup (up to 30000 rows of it read, compared as the join compares keys), lookup_unique how unique the column is in the lookup (1: one row per key). suggested is the pair to start with, two pairs when one column alone repeats in the lookup and both together do not. For an AI application connected through MCP below the level «aggregates» of the AI data policy: by names, types and catalogue only, nothing read (measured false). Needs a token that reads workspaces and permission to read the sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
main 必填 | string | Identifier of the main source
|
lookups 必填 | array<string> | Identifiers of the sources to join with it (the same one may repeat)
|
响应
- 200 The suggested keys
- 400 BAD_REQUEST, NOT_FOUND (a source that is not in the workspace), EXTERNAL (external and real time sources cannot be joined) or TOO_MANY_SOURCES
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/sources/join/suggest" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/join-report
The report of the last run (creation or refresh) of a join of several sources (derived_type join_multi), and a short history of the earlier runs (the last 10 are kept). Per lookup: rows of the main source that found a row in it and that did not (unmatched, with unmatched_empty for empty keys, which never match), the match rate, up to 20 different example keys without a match, rows of the lookup read, keys kept, repeated keys (only the first row of a repeated key is used, rows are never multiplied) with examples, and keys no row used. The names of the sources are the ones they have now. For an AI application connected through MCP, the example keys of key columns with personal data the organization does not share with AI applications are left out (examples_withheld, duplicate_examples_withheld). Needs a token that reads workspaces and permission to read the sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source made by the join
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 The report
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or source not found, or NOT_A_JOIN: the source is not a join of several sources
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/join-report" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/recipe
The recipe of a prepared source («fuente preparada»): its origin (and the origin's columns), the steps (columns named by name), the columns they give, whether they still fit the origin as it is now (check: the first step that does not, and why), the version of the recipe, who changed it and when, and what each step did in the last recomputation (last_report; or the step that failed, when the prepared source kept its previous data). A prepared source is created with POST .../sources/derived (derived_type recipe) and recomputed each time its origin updates; the origin is never changed. An AI application connected through MCP gets the values written in steps about a column with personal data not sent in clear withheld (withheld: true on the step) and, below the level «aggregates» of the AI data policy, no counts of rows. Needs a token that reads workspaces and permission to read the sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the prepared source
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 The recipe
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or source not found, or NOT_A_RECIPE: the source is not prepared with a recipe
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/recipe" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/recipe
Replaces the steps of a prepared source (the whole list, in order) and asks for its recomputation from its origin with them (it runs in the background within seconds). The steps are checked first against the columns of the origin as it is now: when one cannot be used nothing is saved and details says which (step from 0, code, column). The origin is not changed. Needs a token that writes workspaces and permission to edit the source (or to own it) and to run tasks. Answers the recipe as GET does.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the prepared source
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
steps 必填 | array<RecipeStep> | |
响应
- 200 The recipe as it is left (recipe_version + 1, pending true)
- 400 RECIPE_STEPS_INVALID, RECIPE_TOO_MANY_STEPS, RECIPE_TOO_LONG, RECIPE_COLUMN_MISSING, RECIPE_COLUMN_EXISTS, RECIPE_STEP_TYPE, RECIPE_STEP_INVALID, RECIPE_EXPRESSION_INVALID (with details: step, op, code, column, message) or ORIGIN_MISSING
- 401 Invalid authorization
- 403 Access denied (ACCESS_DENIED: without permission to edit the source and run tasks), or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or source not found, or NOT_A_RECIPE
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/recipe" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/recipe/preview
Tries some steps over the first rows of a source (the origin of a recipe) without saving anything: for each step the columns, the rows in and out, the cells changed (or rows removed), the values left empty and the first resulting rows; error is the first step that cannot be used (the steps before it are given). The first steps, when they are filters, are applied by the storage when the rows are read. Regular expressions run with a time limit (RECIPE_REGEX_TIMEOUT in error). For an AI application connected through MCP: only when the AI data policy lets rows go, each column protected as the strictest rule of the columns of the origin it comes from, and refused (AI_POLICY_PERSONAL_DATA) when a filter, a cleaning of only some rows or a removal of duplicates uses a column with personal data not sent in clear. Needs a token that reads workspaces and permission to read the sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the origin source
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
steps | array<RecipeStep> | |
sample | integer | Rows of the origin read (default 200, at most 500)
|
rows | integer | Rows given after each step (default 10, at most 50)
|
响应
- 200 The preview
- 400 RECIPE_STEPS_INVALID, RECIPE_TOO_MANY_STEPS, RECIPE_TOO_LONG or EXTERNAL (external and real-time sources cannot be prepared)
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or source not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/recipe/preview" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/text-analysis
«Analizar textos»: what the AI module of this installation offers for texts (available; the tasks, languages, summaries and topics it advertises: gimodeler 0.21, methods.text-annotate, text-summarize, text-topics; with an older AI module everything is unavailable and nothing else changes), the caps of the plan of the organization (limits: texts per analysis, analyses per month, re-application when the data change, entities, topics over time, most topics, own classifiers, texts generative AI labels in one run; -1 = no limit), what it used this month (usage) and whether the labels with generative AI can be used (labels.code GENAI_PLAN_REQUIRED: a paid plan, AI credit or the organization's own AI key). Needs a token that reads workspaces and permission to read the sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 What can be used and the caps of the plan
- 401 Invalid authorization
- 403 Access denied
- 404 Workspace not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/text-analysis" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/text-analysis
The analysis of texts of a source made with POST .../sources/derived (derived_type text_analysis): its origin and column, the tasks, the language, the column of dates, its topics model and text classifiers, the columns it writes, the last run (last_report), whether a run is waiting or running, whether the origin changed and the plan does not apply it by itself (stale), the caps of the plan and the «Resumen del análisis» (overview: texts analysed and skipped by the cap of the plan, languages, sentiment and its evolution by period, keywords, entities, people, topics with their words, share and examples, labels of each classifier, examples of each sentiment, notes). For any other source: analysis: null, whether it can be analysed (can_create) and its columns (text: a column that can be analysed). For an AI application connected through MCP: the figures, keywords, entities and topics (aggregates); the examples and the people only when the AI data policy lets rows go and the analysed column has no personal data held back; at the level «structure», only the settings. Needs a token that reads workspaces and permission to read the sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 The analysis, or what can be analysed in the source
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or source not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/text-analysis" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/text-analysis/reanalyze
«Volver a analizar»: asks for a new run of an analysis of texts now (within seconds, in the background), with the rows its origin has now. It counts as an analysis of the month (TEXT_ANALYSIS_LIMIT, 403, when the plan's are used up). Needs a token that writes workspaces and permission to edit the source (or to own it) and to run tasks. Answers the analysis as GET does (pending true).
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the analysis source
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
响应
- 200 {result: success, analysis, can_edit}
- 400 NOT_A_TEXT_ANALYSIS
- 401 Invalid authorization
- 403 ACCESS_DENIED, TEXT_ANALYSIS_LIMIT (the analyses of the month of the plan are used; details.offer upgrade) or the AI data policy (AI_POLICY_*)
- 404 Workspace or source not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/text-analysis/reanalyze" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/text-analysis/preview
The analysis of the first rows of a source (at most 20) without writing or counting anything: for each text its language, sentiment (label, value written in the column, score), keywords and entities (entities only when the plan includes them). plan says how many texts a whole analysis would read and whether the cap of the plan would stop it. For an AI application connected through MCP: only when the AI data policy lets rows go, and refused (AI_POLICY_PERSONAL_DATA) when the column has personal data not sent in clear. Needs a token that reads workspaces and permission to read the sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
column 必填 | string | Name of the column of texts (text or nominal)
|
tasks | array<string: language | sentiment | keywords | entities | topics> | Default language, sentiment, keywords; topics are found over every text when the analysis runs, never in a preview
|
language | string | auto (default) or es, en, ca, de, fr, it, pt, ja, zh
|
keywords_top | integer | |
rows | integer | |
响应
- 200 The preview
- 400 TEXT_COLUMN_MISSING, TEXT_TASKS_INVALID, TEXT_LANGUAGE_INVALID, EXTERNAL or an error of the AI module (TEXT_ENGINE_BAD_REQUEST)
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or source not found
- 503 TEXT_ENGINE_OUTDATED (the AI module cannot analyse texts) or TEXT_ENGINE_UNAVAILABLE
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/text-analysis/preview" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/text-analysis/summarize
The sentences that best sum up a group of texts of a source (extractive: sentences of the texts themselves, chosen by the AI module with TextRank; no generative AI): the texts of a sentiment, a topic or a keyword of an analysis of texts, or of a value of a column; at most max_texts texts (the first ones). For an AI application connected through MCP: only when the AI data policy lets rows go, and refused (AI_POLICY_PERSONAL_DATA) when the column (in the source or in the origin of the analysis) has personal data not sent in clear. Needs a token that reads workspaces and permission to read the sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source (an analysis of texts
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
column | string | Name of the column of texts (default: the analysed one)
|
group | object | Which texts (none: the first ones of the source)
|
sentences | integer | Default 3
|
max_texts | integer | Default 200
|
language | string | auto (the most frequent language of the texts) or a code
|
响应
- 200 {column, group, texts (texts read), sentences: [{text, score}]}
- 400 TEXT_COLUMN_MISSING, TEXT_GROUP_INVALID (the source has no column for that group), EXTERNAL
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or source not found
- 503 TEXT_ENGINE_OUTDATED (the AI module cannot summarize texts) or TEXT_ENGINE_UNAVAILABLE
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/text-analysis/summarize" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/images
Images: the objectives of «Analizar imágenes» (objectives: id, icon, whether it sends images to an AI provider, and available when the image worker of this installation has its analyzers; the others are shown as «coming soon»), whether the worker answers (worker), the images a month of the plan of the organization and what it used (plan: per_month, -1 = no limit; analysed; left; previews_left; credits_this_month) and the choices of the organization (settings: keep_originals_days, 0 = forever; strip_gps). Needs a token that reads workspaces and permission to read the sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 {worker, objectives, plan, settings, permissions}
- 401 Invalid authorization
- 403 Access denied
- 404 Workspace not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/images" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/images/sources
Creates an image source (a task, «[SOURCE/IMPORT]»): one row per image with file_name, image_key, width, height, format, size_bytes, taken_at (EXIF) and gps_lat/gps_lon (EXIF, unless the organization removes the GPS position). Send the images as multipart (field files: JPEG, PNG, WebP, HEIC and ZIP files of them, at most 32 files per request) or JSON with urls (1 to 1000 https addresses on the port 443, fetched from the server: only public hosts, at most 3 redirects, each checked). Each image is checked by its bytes (format, size, pixels; ZIP bombs refused), kept in the EU with a 320 px thumbnail and a 1280 px view, and counts against the storage of the plan. The images that cannot be stored are listed in notes of the task. Needs a token that writes workspaces and permission to create sources and run tasks.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
name | string | |
description | string | |
urls | array<string> | |
响应
- 200 {result: success, task, refused}: follow the task with GET .../images/tasks/{taskId}
- 400 BAD_REQUEST, IMAGE_URL_NOT_HTTPS, IMAGE_URL_CREDENTIALS, IMAGE_URL_PORT, IMAGE_URL_INVALID
- 401 Invalid authorization
- 403 ACCESS_DENIED or LIMIT (sources, storage, task time or tasks at once of the plan)
- 404 Workspace not found
- 503 IMAGES_STORAGE_NOT_EU: the images are kept only in the EU
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/images/sources" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/images/tasks/{taskId}
The state of a task of images (storing images or analysing them): status (pending, running, success, failed), progress from 0 to 1, its stages, the source it created (result), the images that could not be stored (notes) and, when it failed, error with the code and the reason (for instance IMAGE_QUOTA_EXCEEDED, IMAGE_WORKER_UNAVAILABLE, IMAGE_AI_CREDITS_EXHAUSTED). For an AI application connected through MCP it asks the AI data policy for «structure». Needs a token that reads workspaces and permission to read the sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
taskId 必填 | path | string | Identifier of the task
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 {id, name, kind (store or analyse), status, progress, stages, result, error, notes, created, started, ended}
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or task not found (TASK_NOT_FOUND)
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/images/tasks/<taskId>" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/images
The stored images of a source (an image source, or the copies of the https addresses of an image column), in the order they were added: id, file_name, width, height, format, size_bytes, taken_at, gps_lat, gps_lon, original_kept and signed addresses of the thumbnail and the larger view (valid until the end of the next week). Paginated with offset and limit (at most 500). Needs a token that reads workspaces and permission to read the sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source
|
offset | query | integer | First image (default 0)
|
limit | query | integer | Images (default 100
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 {source, total, offset, limit, images, image_column}
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or source not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/images" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/images
Adds images to an image source (a task, «[SOURCE/UPDATE]»): multipart, field files (JPEG, PNG, WebP, HEIC and ZIP files, at most 32 files). An image already in the source (the same bytes) is not added twice; the source gets a new version with every image. Needs a token that writes workspaces and permission to edit the source and run tasks.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the image source
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 multipart/form-data
| 字段 | 类型 | 描述 |
|---|
files | array<string (binary)> | |
响应
- 200 {result: success, task, refused}
- 400 BAD_REQUEST or NOT_AN_IMAGE_SOURCE
- 401 Invalid authorization
- 403 ACCESS_DENIED or LIMIT
- 404 Workspace or source not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/images" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/images/column
Prepares an image column of a source (a task): copies the https addresses of the column column that have no copy yet in the workspace, with the same checks as an upload and the guard of the fetches from the server (public hosts only, port 443, at most 3 redirects). The rows of the source do not change; the gallery and the analyses then find each image by its address. Needs a token that writes workspaces and permission to run tasks.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
column 必填 | string | Name of a column of text or category with image keys or https addresses
|
响应
- 200 {result: success, task}
- 400 IMAGE_COLUMN_INVALID
- 401 Invalid authorization
- 403 ACCESS_DENIED or LIMIT
- 404 Workspace or source not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/images/column" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/images/preview
The preview of «Analizar imágenes»: the objective on the first 10 images of the column, with their values, and the estimate of the whole run (images, AI credits, seconds) and the images of the month left. Previews do not count against the images of the month; they have their own monthly cap (IMAGE_PREVIEW_LIMIT). Needs a token that writes workspaces and permission to read the sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
column | string | |
objective | string | quality (default), count, read_text, anonymize, ai_generated or describe (generative AI, AI credits; refused with AI_POLICY_* or IMAGE_AI_* when the organization cannot use it); classify (the classes of PUT …/images/classes: class, class_confidence and, with options.classify.probabilities, class_; IMAGE_CLASSES_MISSING without ready classes); defects (anomalies against the normal images of PUT …/images/normals, or with options.defects.mode all a sample of all the images: anomaly_score 0–100 where 50 is the edge of normal, is_anomaly at options.defects.threshold, 50 by default, and anomaly_boxes; IMAGE_NORMALS_MISSING without enough normal images)
|
options | object | Options by analyzer (only the keys of its defaults, of the same kind). count: {objects: {classes: persons|vehicles|all, min_confidence: 0.05–0.95, zone: [[x, y], …] (3 to 32 points normalized 0–1)}}; quality: {quality: {blur_threshold, min_megapixels}}; describe: {describe: {questions: [{text, kind: yes_no|number|text}] (up to 3), language}}
|
响应
- 200 {column, objective, options, columns, images (ref, file_name, thumb, large, anon_thumb and anon_large when a copy with the faces blurred is kept, status, values), estimate, plan}
- 400 IMAGE_COLUMN_INVALID or IMAGE_OBJECTIVE_UNAVAILABLE
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or source not found
- 429 IMAGE_PREVIEW_LIMIT
- 503 IMAGE_WORKER_DISABLED, IMAGE_WORKER_UNAVAILABLE or IMAGES_STORAGE_NOT_EU
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/images/preview" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/images/analyze
Analyzes the images of a source (a task, «[SOURCE/DERIVE]»): a new derived source (derived_type image_analysis) with the columns of the origin, image_status and the columns of the objective. Objectives, none with generative AI nor AI credits: quality: quality_score (0 to 100), is_blurry, is_dark, is_overexposed, phash and duplicate_of. count (YOLOX-S on the CPU): count_person, count_vehicle (car, bus, truck, motorcycle, bicycle), count_total, count_in_zone (with options.objects.zone) and boxes (JSON [{x, y, w, h, label, score}] normalized 0–1). read_text (Tesseract, Spanish and English): text, text_lines, text_confidence and boxes. anonymize: faces, face_boxes and anonymized; a copy of each image with its faces blurred is kept (never who they are), and shared and public dashboards show it instead of the image. ai_generated: the C2PA Content Credentials of the original: c2pa_present, c2pa_valid, c2pa_trusted, c2pa_signer, c2pa_generator, c2pa_ai_generated and provenance_summary (Spanish, what is proven and what is not; never a percentage). An image already analysed with the same analyzer and options is not analysed again nor counted. Refused with IMAGE_QUOTA_EXCEEDED (403) when the images of the month of the plan are used, and IMAGE_OBJECTIVE_UNAVAILABLE for an objective the installation does not offer yet. auto_refresh: also analyses the new images when the origin changes. Needs a token that writes workspaces and permission to create sources and run tasks.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source with the images
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
column | string | Image column (default image_key in an image source)
|
objective | string | quality (default), count, read_text, anonymize, ai_generated or describe (generative AI, AI credits; refused with AI_POLICY_* or IMAGE_AI_* when the organization cannot use it); classify (the classes of PUT …/images/classes: class, class_confidence and, with options.classify.probabilities, class_; IMAGE_CLASSES_MISSING without ready classes); defects (anomalies against the normal images of PUT …/images/normals, or with options.defects.mode all a sample of all the images: anomaly_score 0–100 where 50 is the edge of normal, is_anomaly at options.defects.threshold, 50 by default, and anomaly_boxes; IMAGE_NORMALS_MISSING without enough normal images)
|
options | object | Options by analyzer (only the keys of its defaults, of the same kind). count: {objects: {classes: persons|vehicles|all, min_confidence: 0.05–0.95, zone: [[x, y], …] (3 to 32 points normalized 0–1)}}; quality: {quality: {blur_threshold, min_megapixels}}; describe: {describe: {questions: [{text, kind: yes_no|number|text}] (up to 3), language}}
|
name | string | |
auto_refresh | boolean | |
响应
- 200 {result: success, task, name}
- 400 ORIGIN_SOURCE_INVALID, IMAGE_COLUMN_INVALID or IMAGE_OBJECTIVE_UNAVAILABLE
- 401 Invalid authorization
- 403 ACCESS_DENIED, LIMIT or IMAGE_QUOTA_EXCEEDED (the images of the month of the plan are used; message with the figure)
- 404 Workspace or source not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/images/analyze" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/images/search
How many images of an image column are prepared for «Parecidas» and «Buscar por descripción» (their vector, SigLIP 2 on the CPU of AIR-Core, no generative AI): total (distinct images of the column), prepared, missing (without a vector yet: POST .../images/search/prepare) and unresolved (values without a stored image). Refused with IMAGE_SEARCH_UNAVAILABLE (503) when the installation has no image worker with the analyzer embed.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source with the images
|
column | query | string | Image column (default image_key in an image source)
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 {source, column, total, prepared, missing, unresolved}
- 400 IMAGE_COLUMN_INVALID
- 503 IMAGE_SEARCH_UNAVAILABLE
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/images/search" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/images/search
«Buscar por descripción»: the images of the column nearest to a text in Spanish, English or another language (the vector of the text and those of the images, SigLIP 2 on the CPU of AIR-Core; no generative AI, no AI credits, nothing counted). Approximate: the results are sorted by closeness, score (about −0.1 to 0.3) only sorts them. Only the prepared images are searched (missing says how many are not). Each result: ref (the value of the image column), image (its key), file_name, score; images: the signed addresses of their thumbnails and larger views.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source with the images
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
text 必填 | string | |
column | string | Image column (default image_key in an image source)
|
limit | integer | Results (24 by default)
|
响应
- 200 {source, column, text, approximate: true, results: [{ref, image, file_name, score}], images, total, prepared, missing, unresolved}
- 400 BAD_REQUEST, IMAGE_COLUMN_INVALID
- 503 IMAGE_SEARCH_UNAVAILABLE, TEXT_SEARCH_UNAVAILABLE
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/images/search" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/images/similar
«Parecidas»: the images of the same column nearest to one (by what they look like; the cosine of their SigLIP 2 vectors as a similarity 0–100; 95 or more: almost the same photo), the image itself left out. No generative AI, no AI credits, nothing counted; it identifies nobody. Refused with IMAGE_NOT_PREPARED (409) when the image has no vector yet (POST .../images/search/prepare) and IMAGE_NOT_FOUND (404) when it is not in the column.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source with the images
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
ref | string | The value of the image column (an image key or an https address)
|
image | string | The key of the image (instead of ref)
|
column | string | |
limit | integer | Results (12 by default)
|
响应
- 200 {source, column, of, approximate: true, results: [{ref, image, file_name, score}], images, total, prepared, missing, unresolved}
- 404 IMAGE_NOT_FOUND
- 409 IMAGE_NOT_PREPARED
- 503 IMAGE_SEARCH_UNAVAILABLE
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/images/similar" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/images/duplicates
The groups of near duplicates of an image column (pairs at a cosine of 0.95 or more: a copy resized, recompressed, cut at the edges, mirrored or retouched), at most 200 groups, the largest first, each in the order of the rows. Approximate (locality-sensitive hashing, checked exactly): some pairs can be missed. Only the prepared images.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source with the images
|
column | query | string | Image column
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 {source, column, threshold, approximate: true, groups: [[ref, …]], total, prepared, missing, unresolved}
- 503 IMAGE_SEARCH_UNAVAILABLE
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/images/duplicates" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/images/search/prepare
«Preparar la búsqueda»: a task («[SOURCE/UPDATE]», image-ingest mode embed) that copies the https addresses without a copy and computes the vector of each image of the column without one (the analyzer embed: SigLIP 2 on the CPU of AIR-Core, no generative AI, no AI credits). Each image prepared counts against the images of the month of the plan (refused with IMAGE_QUOTA_EXCEEDED when they do not fit); those prepared are not repeated. {task: "", missing: 0} when nothing is missing. Needs a token that writes workspaces and permission to run tasks.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source with the images
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
响应
- 200 {result: success, task, missing}
- 403 ACCESS_DENIED, LIMIT
- 503 IMAGE_SEARCH_UNAVAILABLE
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/images/search/prepare" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/images/classes
«Clasificar con mis ejemplos»: the classes of an image column of the source and their example images (the values of the column), as marked in the gallery («Clases y ejemplos»), with the evaluation of the last training (each example tried by a model that had not seen it: folds, examples, correct, accuracy, per_class, confusions) when it is up to date. ready says whether they can classify (2 classes or more, 2 examples or more each); person_like warns of a class name that looks like a person's (AIR-Core identifies nobody).
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source with the images
|
column | query | string | Image column (default image_key in an image source)
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 {id, source, column, version, classes: [{id, name, examples, count, person_like}], ready, why, metrics, limits}
- 400 IMAGE_COLUMN_INVALID
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/images/classes" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
PUT /api/v2/workspace/{workspaceId}/source/{sourceId}/images/classes
Replaces the classes of an image column and their examples (at most 20 classes, 200 examples each, 1000 in all; names of at most 40 characters, different; an image in one class only). The examples without their vector get it (the analyzer embed, SigLIP 2 on the CPU of AIR-Core; they count in the images of the month), a classifier is trained on the vectors (logistic regression with probabilities calibrated by cross-validation, in the app, under a second) and the analyses with the objective classify that use these classes are asked to classify again. Needs permission to edit the source.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source with the images
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
column | string | |
classes 必填 | array<object> | |
响应
- 200 {result: success, …the GET answer, analyses_updated}
- 400 IMAGE_CLASSES_INVALID, IMAGE_COLUMN_INVALID
- 403 ACCESS_DENIED, IMAGE_QUOTA_EXCEEDED
- 409 IMAGE_CLASSES_UNREADABLE
示例
curl -X PUT "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/images/classes" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/images/normals
«Detectar defectos»: the normal images (without defects) marked in an image column of the source, as values of the column, and whether they are enough (5 or more; 10 or more recommended). The bank learnt from them is made when an analysis or a preview needs it (at most 60 of them, spread over the list).
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source with the images
|
column | query | string | Image column (default image_key in an image source)
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 {id, source, column, version, examples, count, ready, limits}
- 400 IMAGE_COLUMN_INVALID
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/images/normals" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
PUT /api/v2/workspace/{workspaceId}/source/{sourceId}/images/normals
Replaces the normal images of an image column (at most 500; values of the column or image keys). Needs permission to edit the source.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the source with the images
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
column | string | |
examples 必填 | array<string> | |
响应
- 200 {result: success, …the GET answer}
- 400 IMAGE_NORMALS_INVALID, IMAGE_COLUMN_INVALID
- 403 ACCESS_DENIED
示例
curl -X PUT "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/images/normals" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/images/notices
«Avísame cuando…» on an analysis of images (the source given is the analysis): creates a simple notice of «Automatizaciones» (the same as POST /api/v2/workspace/{workspaceId}/automations would: trigger source_updated on the analysis, one rule, an email to the notice list) from a preset: people (count_person > value), vehicles (count_vehicle > value), defect (is_anomaly = true), class (class = value), blurry (is_blurry = true); only the presets whose column the analysis has. A refresh of the analysis writes the rows it already had as known, so the notice fires once, for the new images (it needs auto_refresh in the analysis). Its email shows the thumbnails of the first images (the copy with the faces blurred when there is one). Needs permission to edit the workspace.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the analysis of images
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
preset 必填 | string: people | vehicles | defect | class | blurry | |
value | object | A whole number 0–10000 (people, vehicles) or a class of the analysis (class)
|
响应
- 200 {result: success, preset, name, …the automation as POST /api/v2/…/automations answers it}
- 400 IMAGE_NOTICE_PRESET, IMAGE_NOTICE_VALUE
- 403 ACCESS_DENIED
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/images/notices" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/cameras
The IP cameras of the workspace (they push their photos to AIR-Core: POST https:///api/cameras/{cameraId}/frames with the token of the camera, see the technical manual), each with its state (active, waiting for the first photo, paused, over_quota: the images of the month of the plan are used up, not_included: the plan has no cameras), its rate, its counters and its image source; the cameras of the plan of the organization and the least seconds between two photos; and the days the originals and the photos are kept. Never the tokens nor the photos. Needs a token that reads workspaces.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 {cameras: [Camera], plan: {cameras, used, left, min_seconds, per_second, included}, retention: {keep_originals_days, keep_frames_days}, permissions}
- 401 Invalid authorization
- 403 ACCESS_DENIED, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/cameras" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/cameras
Creates a camera and its image source (empty until the first photo; columns of an image source plus frame and received_at). The answer has the addresses of the camera with its secret token (130 bits): they are NOT shown again (only a hash is kept); POST …/cameras/{cameraId}/token makes new ones. The rate cannot be faster than the plan allows (standard: a photo every 900 s, pro: every 60 s, gold: down to every second; the owner tunes it). Cameras are not in the free plan. Needs a token that writes workspaces and permission to create and edit sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
name 必填 | string | |
location | string | |
lat | number | |
lon | number | |
rate_seconds | integer | Least seconds between two photos (at least the minimum of the plan; the minimum by default)
|
响应
- 200 {result: success, camera: Camera, addresses: {url (token in the path), bearer_url (send Authorization: Bearer <token>), query_url (?token=), token}}
- 400 CAMERA_NAME_MISSING, CAMERA_PLACE_INVALID, CAMERA_RATE_TOO_FAST, CAMERA_RATE_INVALID
- 403 ACCESS_DENIED, CAMERA_NOT_IN_PLAN, CAMERA_LIMIT, LIMIT
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/cameras" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/cameras/{cameraId}
The state and the counters of a camera: status, rate_seconds, plan_min_seconds, last_frame_at, last_contact_at, last_error ({code, at}: the last photo refused in the last 24 h), frames_today, dropped_today (photos the same as the one before: not stored, not counted), frames_total, dropped_total, source, endpoint (the address without the token). Needs a token that reads workspaces.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
cameraId 必填 | path | string | Identifier of the camera
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 {camera: Camera}
- 404 CAMERA_NOT_FOUND
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/cameras/<cameraId>" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
PATCH /api/v2/workspace/{workspaceId}/cameras/{cameraId}
Changes the name, the place (location, lat, lon) or the rate (rate_seconds, never faster than the plan) of a camera. Needs a token that writes workspaces and permission to edit sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
cameraId 必填 | path | string | Identifier of the camera
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
name | string | |
location | string | |
lat | number | |
lon | number | |
rate_seconds | integer | |
响应
- 200 {result: success, camera: Camera}
- 400 CAMERA_NAME_MISSING, CAMERA_PLACE_INVALID, CAMERA_RATE_TOO_FAST
- 403 ACCESS_DENIED
- 404 CAMERA_NOT_FOUND
示例
curl -X PATCH "https://app.air-core.io/api/v2/workspace/<workspaceId>/cameras/<cameraId>" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
DELETE /api/v2/workspace/{workspaceId}/cameras/{cameraId}
Deletes a camera: its address and token stop working at once. Its image source and its photos stay, as any image source (delete the source to remove them). Needs a token that writes workspaces and permission to edit sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
cameraId 必填 | path | string | Identifier of the camera
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
响应
- 200 {result: success, deleted, source}
- 404 CAMERA_NOT_FOUND
示例
curl -X DELETE "https://app.air-core.io/api/v2/workspace/<workspaceId>/cameras/<cameraId>" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/cameras/{cameraId}/pause
Pauses a camera: the photos it sends are refused (403 CAMERA_PAUSED) and nothing is stored nor counted. Needs a token that writes workspaces and permission to edit sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
cameraId 必填 | path | string | Identifier of the camera
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
响应
- 200 {result: success, camera: Camera}
- 404 CAMERA_NOT_FOUND
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/cameras/<cameraId>/pause" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/cameras/{cameraId}/resume
Resumes a paused camera. Needs a token that writes workspaces and permission to edit sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
cameraId 必填 | path | string | Identifier of the camera
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
响应
- 200 {result: success, camera: Camera}
- 404 CAMERA_NOT_FOUND
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/cameras/<cameraId>/resume" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/cameras/{cameraId}/token
A new secret token for a camera: the old address stops working at once. The answer has the new addresses with the token; they are NOT shown again. Needs a token that writes workspaces and permission to edit sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
cameraId 必填 | path | string | Identifier of the camera
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
响应
- 200 {result: success, camera: Camera, addresses: {url, bearer_url, query_url, token}}
- 404 CAMERA_NOT_FOUND
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/cameras/<cameraId>/token" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/rows
Rows of a data source with their row ids (ids, parallel to instances), to edit them in place. For an AI application connected through MCP, rows only when the AI data policy of the organization allows them, with the personal data protected. The routes of /instances do not change.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
where | query | string | Filter, as a JSON of QueryTree (filter is accepted too)
|
order_by | query | string | Index of the feature to sort by and 'asc' or 'desc'
|
select | query | string | Indexes of the features to return (all by default)
|
offset | query | integer (int32) | Rows to skip
|
limit | query | integer (int32) | Rows to return (default 100, at most 500)
|
响应
- 200 The rows
- 400 INVALID_FILTER
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/rows" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/rows
Edits rows in place, as a spreadsheet: an ordered list of operations (set a cell, insert rows, delete rows by row id), all or nothing, at most 1000 operations or rows. Calculated columns are computed again when their expression only reads values of the row. Needs a token that writes workspaces and permission to edit the source (or to own it) and to run tasks.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
ops 必填 | array<object> | |
响应
- 200 Applied ({result: success, applied, inserted: {tempId: rid}, missing, counts, version, instances, calculated?}), or refused with result error and code VALUE, UNIQUE, OPS_LIMIT, LIMIT or STORAGE_OLD
- 400 OPS (malformed) or NOT_EDITABLE
- 403 Access denied
- 409 BUSY: a task or another edit has the source
- 504 TIMEOUT: nothing was changed
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/rows" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/columns/{feature}/transform
Cleans a column in place (all rows, or those of the filter). With dry_run, only how many cells would change and a sample before and after (nothing is written). The version before the cleaning is kept for 24 hours (it counts in the size of the organization meanwhile) and undo restores it. Operations by type of column: text trim {collapse}, lower, upper, capitalize, replace {find, replace, mode contains|exact, case}, regex_replace {pattern (at most 500 characters), replace, case}, prefix|suffix {text}, fill_empty {value}, to_null {value}, merge_values {values: [{from, to}]} (each cell that is exactly from, same case and spaces, becomes to: the merge of the groups of GET .../columns/{feature}/variants, at most 500 pairs; no to may also be a from; it is one operation with one undo, its preview counts the rows of each value); numbers round {decimals 0-10}, multiply|add {value}, clip {min, max}, abs, fill_empty {value}; dates shift {ms}, fill_empty {value}; booleans invert, fill_empty {value}.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
feature 必填 | path | integer | Index of the column
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
op 必填 | string: trim | lower | upper | capitalize | replace | regex_replace | prefix | suffix | |
args | object | Arguments of the operation
|
filter | QueryTree | Tree used to describe a query. Used in order to query instances of data sources.
|
dry_run | boolean | Only the preview: {changed, sample: [{rid, before, after}]} (at most 20)
|
响应
- 200 {result: success, changed, version, instances, undo, calculated?} (with dry_run: {dry_run: true, changed, sample}); refused with result error and code STORAGE_OLD, VALUE, UNIQUE or LIMIT
- 400 FEATURE, OP, ARGS, INVALID_FILTER, FILTER, UNSUPPORTED or NOT_EDITABLE
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 409 BUSY
- 504 TIMEOUT
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/columns/<feature>/transform" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/columns/{feature}/profile
Profile of a column computed by the storage over every row (or those of the filter): rows, nulls, empty texts, distinct values, the 10 most frequent values and min, max and average (numbers; min and max of dates). With duplicates, also how many rows repeat an earlier row (what dedupe would delete).
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
feature 必填 | path | integer | Index of the column
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
where | query | string | Filter, as a JSON of QueryTree
|
duplicates | query | string | 'all' (whole rows) or a JSON list of feature indexes
|
响应
- 200 The profile
- 400 FEATURE, INVALID_FILTER or UNSUPPORTED (external and real-time sources)
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/columns/<feature>/profile" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/columns/{feature}/variants
«Agrupar variantes», without AI and without credits (free plan too): groups of values of a text column (nominal or text) that are the same thing written differently («Madrid», «madrid », «Mádrid», «Madriz»; «C/ Mayor» and «Calle Mayor»). Values are normalised (case, accents, spaces, punctuation and, with abbreviations, a small list of abbreviations) and compared with a similarity (the mean of Jaro-Winkler and the normalised Levenshtein similarity; texts whose numbers differ never match; texts shorter than 4 characters only match when equal). It works on the DISTINCT values of the column with their counts: the storage says how many there are (distinct, column_profile); up to 200 it counts every one of them (method: histogram, no row is read); with more, only this column is read by streaming (method: stream) up to the rows of the plan (200,000 free, 1,000,000 paid, 2,000,000 without limits; estimated only when not every row was read) and the most frequent values are compared, up to the cap of the plan (2,000 free, 10,000 paid, 20,000 without limits; truncated when the column has more: values of distinct). Each group has its proposed canonical value (the most frequent), its values with their rows and similarity to it, and suggested for those proposed for the merge. merge_args are the arguments of POST .../columns/{feature}/transform with op merge_values that merges the suggested values. For an AI application connected through MCP: refused (AI_POLICY_PERSONAL_DATA) on a column, or with a filter, with personal data it may not see.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
feature 必填 | path | integer | Index of the column (nominal or text)
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
threshold | query | number | Least similarity to group, from 0.5 to 1 (default 0.85; 1 = only the same normalised form)
|
abbreviations | query | boolean | Expand the small list of abbreviations (c/, avda., pza., ctra., ayto., sta.…) before comparing (default true)
|
where | query | string | Filter, as a JSON of QueryTree
|
响应
- 200 The groups of variants
- 400 FEATURE, TYPE (not a text column), ARGS, INVALID_FILTER, UNSUPPORTED (external and real-time sources) or STORAGE_OLD
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/columns/<feature>/variants" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/near-duplicates
«Filas casi duplicadas», without AI and without credits (free plan too): clusters of rows that are almost the same in some columns (the same customer with small differences). Each row is the set of the character 3-grams of the normalised values of those columns (tagged with their column); MinHash with 64 hash functions of fixed seeds (the same answer every time) and LSH banding tuned to the threshold find the candidate pairs, kept when the exact Jaccard similarity of their 3-grams reaches the threshold; every row of a cluster is at the threshold of its first row (a chain ABC with A and C apart does not put C with A). Rows are read in pages with their ids from the first one, up to the cap of the plan (10,000 rows free, 100,000 paid, 200,000 without limits) or max_rows, and for 25 seconds at most: estimated (and stopped: cap or time) when not every row was read. Each cluster has its rows (row id, cells of the compared columns, differs: positions of the cells that differ from the first row, similarity to it) and a QueryTree filter that shows them in a table (null when too long). Nothing is deleted: remove the extra rows with POST .../rows (delete by row id), kept in the version history. For an AI application connected through MCP: rows (the policy must let rows go), refused over columns with personal data it may not see.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
features | query | string | Indexes of the columns compared, separated by commas or as a JSON list (default: every column that is not calculated, up to 20)
|
threshold | query | number | Least estimated Jaccard similarity, from 0.5 to 1 (default 0.8)
|
abbreviations | query | boolean | Expand the small list of abbreviations before comparing (default true)
|
max_rows | query | integer | Rows to read at most (never more than the cap of the plan)
|
响应
- 200 The clusters of near-duplicate rows
- 400 FEATURE, ARGS, UNSUPPORTED (external and real-time sources) or STORAGE_OLD
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Not found
- 429 BUSY: other searches of near duplicates are running
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/near-duplicates" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/dedupe
Removes the rows that repeat the values of some features (whole rows when none are given; nulls equal), keeping the first or the last of each group. With dry_run, only how many rows it would delete. The version before is kept for 24 hours and undo restores it.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
features | array<integer> | |
keep | string: first | last | |
dry_run | boolean | |
响应
- 200 {result: success, deleted, version, instances, undo} (with dry_run: {dry_run: true, deleted}); refused with result error and code STORAGE_OLD or LIMIT
- 400 FEATURE, ARGS, UNSUPPORTED (CrateDB sources) or NOT_EDITABLE
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 409 BUSY
- 504 TIMEOUT
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/dedupe" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/undo
Undoes the last cleaning of a column or removal of duplicates: puts back the version kept before it, within 24 hours and while nothing else changed the source (UNDO_GONE otherwise). The current version is deleted.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
响应
- 200 {result: success, version, instances, undone}
- 403 Access denied
- 409 UNDO_GONE or BUSY
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/undo" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/detach
Turns a derived source (filter, join, merge, extend, aggregate, the predictions of a model, a forecast) into an independent stored source: the data stays, its update configuration stops being derived and its parents no longer refresh it. Needs permission to edit the source (or to own it).
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
响应
- 200 {result: success, update_effect: none, detached: {at, derived_type, derived_from, derived_from2, model}}
- 400 NOT_DERIVED
- 403 Access denied
- 409 BUSY
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/detach" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/versions
The version history of the data of the source, the newest first: who made each version, when and how (kind: import, update, delete_rows, update_rows, columns, edit, clean, dedupe, restore, previous), its rows and size, and whether its data is kept (restorable). policy says what the organization keeps: keep (previous versions, 0 = no history), max (of its plan), auto_hours (versions kept for sources that update by themselves; 0 = no limit) and stored (false for sources in a CrateDB database: the history records who and when but keeps no data). Kept versions count in the size of the organization. Needs to read the sources of the workspace.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 {result: success, policy: {keep, max, auto_hours, stored}, kept_size, held_size, held_over_limit, versions: [{version, created, current, restorable, kind, task, authors: [{uid, name}], counts, note, size, instances, held_by, held_names}]}. A version something still needs (a model learned from it, a version of a model, a comparison of methods, a training running) is never deleted: held_by says how many models need it and held_names names them (the first five); it is kept, restorable and counted in held_size whatever the history keeps, and goes away by itself when nothing needs it. held_over_limit: the organization is over its size limit only because of those versions (updates of the data still work).
- 403 Access denied
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/versions" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/versions/{version}/restore
Restores a kept version of the source: a new version that is a copy of it (its rows and its columns), added to the history as kind restore; nothing is rewritten and the version before stays in the history. Same permission, limits and lock as an edit of the rows (permission to edit the source or to own it, and to run tasks).
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
version 必填 | path | integer | The version to restore, as the history gives it
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
响应
- 200 {result: success, version, instances, restored}
- 400 VERSION or NOT_EDITABLE
- 403 Access denied, or LIMIT
- 409 VERSION_GONE (the version is not kept) or BUSY
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/versions/<version>/restore" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/sql/tables
The tables a read-only SQL query can read in a workspace: one per data source, named after it (lower case, no accents, _ between words, unique), with its columns (name as SQL sees it, sql as a query writes it, the field it comes from and its type); the caps of the plan of the organization; and the functions a query may call. Reads no rows. For people with a token that reads workspaces and permission to read the sources of the workspace; AI applications connected through MCP, MCP clients and the assistant get 403 SQL_NOT_FOR_AI_APPS.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 The tables, the caps and the functions
- 401 Invalid authorization
- 403 ACCESS_DENIED (the token does not read workspaces) or SQL_NOT_FOR_AI_APPS
- 404 Workspace not found, or no permission to read its sources
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/sql/tables" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/sql
Runs a read-only SQL query (SQLite dialect) over one or several data sources of the workspace and answers a page of its result, or the whole result as CSV with format: csv. One statement that starts with SELECT, WITH or VALUES; never ATTACH, PRAGMA, writes, extensions, the internals of SQLite, parameters or functions outside the allowed list (see GET .../sql/tables). The tables are the ones of GET .../sql/tables; sources gives a source of this workspace another table name (a source of another workspace or organization is refused, SQL_UNKNOWN_SOURCE, without reading it). Only the tables and columns the query names are read, up to the caps of the plan: a read cut by a cap says so in read.partial. The query runs in a process of its own, stopped at the time or memory limit of the plan (SQL_TIMEOUT, SQL_MEMORY_LIMIT). One query at a time per person. For people with a token that reads workspaces and permission to read the sources of the workspace (the same rows and columns they see on the page of each source); AI applications connected through MCP, MCP clients and the assistant get 403 SQL_NOT_FOR_AI_APPS.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
sql 必填 | string | The query (at most 20000 characters)
|
sources | object | array<object> | Optional table names of your own for sources of this workspace: {alias: sourceId} or [{alias, source}] (letters, digits and _, not a keyword, at most 20)
|
offset | integer | Rows of the result to skip (default 0)
|
limit | integer | Rows of the page (default 100, at most max_page_rows of the plan)
|
format | string: json | csv | csv: the whole result as a CSV file
|
响应
- 200 A page of the result (JSON), or the whole result as CSV (UTF-8 with a byte order mark, at most `max_result_rows` of the plan) with format csv
- 400 The query is refused or fails, with its place in the text when known: SQL_EMPTY, SQL_TOO_LONG, SQL_SYNTAX, SQL_MULTIPLE_STATEMENTS, SQL_NOT_A_QUERY, SQL_NOT_READ_ONLY, SQL_FORBIDDEN_STATEMENT, SQL_FORBIDDEN_NAME, SQL_FUNCTION_NOT_ALLOWED, SQL_PARAMETERS, SQL_UNKNOWN_TABLE, SQL_UNKNOWN_COLUMN, SQL_UNKNOWN_FUNCTION, SQL_ERROR, SQL_BAD_ALIAS, SQL_BAD_SOURCES, SQL_TOO_MANY_SOURCES, SQL_TOO_MANY_COLUMNS, SQL_TIMEOUT or SQL_MEMORY_LIMIT
- 401 Invalid authorization
- 403 ACCESS_DENIED (the token does not read workspaces) or SQL_NOT_FOR_AI_APPS
- 404 Workspace not found, no permission to read its sources, or SQL_UNKNOWN_SOURCE (an alias names a source that is not in this workspace)
- 429 SQL_BUSY (a query of the same person, or too many of the server, are running) or TOO_MANY_REQUESTS (30 queries per minute)
- 503 SOURCE_UNAVAILABLE: the data of a table could not be read right now
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/sql" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/sql/source
Saves a read-only SQL query as a new derived data source (type sql) that is computed again whenever one of the sources it reads changes. The query is checked and prepared (its columns are known without reading any row); every table must be a stored source of the workspace and their rows must fit the cap of the plan, because a saved query reads them whole. Each run checks again that its owner can read the sources of the workspace, the query, the caps of the current plan and its columns. Answers the task that creates the source. Needs a token that writes workspaces, permission to read the sources and to create sources and tasks; AI applications connected through MCP, MCP clients and the assistant get 403 SQL_NOT_FOR_AI_APPS.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
sql 必填 | string | The query (see SqlQuery)
|
sources | object | array<object> | Optional table names of your own for sources of this workspace, as in SqlQuery; they are kept with the saved query
|
name 必填 | string | Name of the new source (1 to 120 characters)
|
description | string | At most 300 characters
|
响应
- 200 The task that creates the source
- 400 BAD_NAME, BAD_DESCRIPTION, SQL_NO_TABLES, EXTERNAL, SQL_TOO_MANY_ROWS or any refusal of the query (see POST .../sql)
- 401 Invalid authorization
- 403 ACCESS_DENIED (the token does not write workspaces, or no permission to create sources and tasks), LIMIT (plan) or SQL_NOT_FOR_AI_APPS
- 404 Workspace not found, no permission to read its sources, or SQL_UNKNOWN_SOURCE
- 429 SQL_BUSY or TOO_MANY_REQUESTS
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/sql/source" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/quality/rules
The data quality rules of a source («Calidad»): per column (not_empty, unique, range, allowed_values, pattern, not_future) or on the source (row_count, freshness), each with its severity (warning or error) and whether it is enabled. A rule names its field by name; index is its position now (-1 and missing: true when the field is gone: the rule then fails). With suggestions=true, the rules AIR-Core suggests from the catalogue of the source, the statistics of its columns, the names of the columns and its automatic updates, each with its reason (nothing is saved until they are sent with PUT). An AI application connected through MCP gets the rules without the values they hold (allowed values, bounds, the text of a pattern) below the level «aggregates» of the AI data policy, or for a field with personal data not allowed (withheld_for_ai). Needs a token that reads workspaces and permission to read the sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
suggestions | query | string: true | false | true: adds the suggested rules
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 The rules
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or source not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/quality/rules" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
PUT /api/v2/workspace/{workspaceId}/source/{sourceId}/quality/rules
Replaces the quality rules of a source with the list sent (an empty list removes them) and checks them now: the answer waits up to 20 seconds for the check (checking: true when it goes on in the background). A rule keeps its id when it sends one of the current list (its history and its alerts follow it); the other ones get a new id. Up to 30 rules. Refused (400), never cut: an unknown kind, key or parameter, a field that does not exist or of a type the kind does not apply to, invalid parameters or a repeated rule. alert turns the quality alert of the source on or off, with a threshold of the score (needs permission to edit the workspace). External and real-time sources cannot have rules (UNSUPPORTED_SOURCE). Needs a token that writes workspaces and permission to edit the source (or to own it). Answers the report as GET .../quality does.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
rules | array<QualityRule> | The whole list: it replaces the current one
|
check | boolean | Check them now (default true)
|
alert | object | The quality alert of the source: on or off, and the score under which it also fires (0: only when a rule breaks)
|
响应
- 200 The report of the source with its new rules
- 400 BAD_REQUEST, TOO_MANY_RULES, UNKNOWN_KEY, UNKNOWN_KIND, UNKNOWN_FIELD, FIELD_TYPE, BAD_SEVERITY, BAD_PARAMS, DUPLICATE_RULE (details.rule: its position), BAD_THRESHOLD or UNSUPPORTED_SOURCE
- 401 Invalid authorization
- 403 Access denied (ACCESS_DENIED: without permission to edit the source, or the workspace for `alert`), or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or source not found
示例
curl -X PUT "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/quality/rules" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/source/{sourceId}/quality
The quality report of a source: its rules, the last check (when, why, the score from 0 to 100 and its status, the rows, and per rule its status pass, fail or unknown with the rows that break it, their share, whether the count is an estimate and some failing values for patterns and unique values), whether the data changed after it (stale; the watcher checks them again after each update) and the history of the score. Rules never checked yet are checked now. Score: each rule weighs 3 (error) or 1 (warning); a rule that passes counts fully, one on rows that fails counts at most half its weight, less the more rows break it (0.5 × (1 − share)), one on the source that fails or whose field is gone counts nothing; rules that could not be checked are left out; score = round(100 × Σ weight × value / Σ weight). Every rule is counted by the storage over all the rows (one scan for all of them); a pattern the storage cannot test (a preset or a regular expression) is checked on a sample of up to 2000 non-empty values spread over the source, and its count is an estimate unless the sample held them all. An AI application connected through MCP needs the level «aggregates» and gets the failing values only when rows may go, never the filter of the failing rows. Needs a token that reads workspaces and permission to read the sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 The report (report null when there are no rules)
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or source not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/quality" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/source/{sourceId}/quality/check
Checks the quality rules of a source now (the answer waits up to 20 seconds; checking: true when the check goes on in the background). Asked again within 15 seconds with nothing changed, it answers the last check. Needs a token that writes workspaces and permission to edit the source (or to own it). Answers the report as GET .../quality does.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
sourceId 必填 | path | string | Identifier of the data source
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
响应
- 200 The report
- 400 UNSUPPORTED_SOURCE (external and real-time sources)
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or source not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/source/<sourceId>/quality/check" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/quality
The quality score of each source of a workspace that has rules: score (null before its first check), status (ok, warning, error, unknown, or pending before its first check), when it was checked and how many rules it has. Needs a token that reads workspaces and permission to read the sources.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 The scores, by source id
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/quality" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
models
Models API. Models allow you to use artificial intelligence algorithms to analyze your data and extract knowledge from it.
GET /api/v2/workspace/{workspaceId}/topics-model/{modelId}
A topics model (model type topics: made by an analysis of texts with the task topics, or by the goal «Temas en textos» of the model wizard): its column of texts and of dates, language, method, number of topics and each topic with the name people gave it (or its first words), its words with their weight, its texts and its share; with a column of dates, the share of each topic by period (prevalence). Needs a token that reads workspaces and permission to read the models.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the topics model
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 The topics model
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace not found, or NOT_FOUND: not a topics model of the workspace
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/topics-model/<modelId>" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/models/methods
Lists the methods that can be used to create models in this installation, by type of model and in the recommended order (the first ones are good defaults). They depend on the version of the AI module: source is 'ai-module' when the module advertises them and 'default' when it does not (an earlier module, or one that cannot be reached right now), and then they are the usual ones. Any valid token can call it, also one limited to a workspace.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
x-auth-token 必填 | header | string | Autentication token
|
响应
- 200 Normal response.
- 401 Invalid authorization
示例
curl -X GET "https://app.air-core.io/api/v2/models/methods" \
-H "x-auth-token: $AIRCORE_TOKEN"
GET /api/v2/workspace/{workspaceId}/models
Lists the models of a workspace
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Autentication token
|
page | query | integer (int32) | Requested page (starts with 0)
|
limit | query | integer (int32) | Max number of items per page (max 500)
|
响应
- 200 Normal response. Paginated result.
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/models" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/models
Creates a new artificial intelligence model. This may require advanced knowledge if you want to use specific configurations. Please refer to AIR-Core documentation on how to create models using this API.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
name | string | Model name (max 80 characters)
|
description | string | Model description (max 300 characters)
|
type | string: classifier | regressor | clustering | outlier | Model type: 'classifier' (nominal or logic target) and 'regressor' (numeric target) are supervised; 'clustering' and 'outlier' (anomaly detection) are unsupervised (target is ignored, but it must be a valid index).
|
method | string: forest | hist-gradient | xgboost | lightgbm | gradient | extra-trees | logistic | linear | Method to build the model with. The methods offered depend on the version of the AI module of the installation: GET /api/v2/models/methods lists them by type, in the recommended order. With an AI module that does not advertise them they are: classifier 'bayes', 'forest', 'gradient', 'logistic', 'mlp', 'neighbors', 'sv', 'tree' and 'xgb'; regressor 'forest', 'gradient', 'linear', 'mlp', 'neighbors', 'sv', 'tree' and 'xgb'; clustering 'dbscan' and 'kmeans'; outlier 'elliptic-envelope', 'isolation-forest' and 'one-class-svm'. An AI module that advertises them (gimodeler 0.14) may add 'hist-gradient' (histogram-based gradient boosting, handles missing values), 'xgboost' (XGBoost gradient boosting; 'xgb' is XGBoost's random forest mode), 'lightgbm', 'extra-trees' and 'rgf' (classifier and regressor), 'multinomial-nb' and 'complement-nb' (classifier; non-negative inputs only), 'ridge', 'lasso' and 'elastic-net' (regressor), 'gaussianmixture', 'agglomerative' and 'spectral' (clustering) and 'local-outlier-factor' (outlier), and leave out a method whose library is not installed. A known method the AI module does not offer is refused with 400 METHOD_NOT_AVAILABLE, and an unknown one with 400 UNKNOWN_METHOD; the message lists the methods available.
|
source | string | Identifier of the source to use for training.
|
target | integer (int32) | Index of the feature to use as target (if applicable).
|
configuration | object | Dictionary of configuration attributes for the model (Advanced).
|
training_configuration | object | Training configuration (if applicable).
|
second_attempt | boolean | Quality guarantee (classifiers and regressors). When the trained model is not better than the naive prediction (always answering the most frequent class, or always predicting the mean), AIR-Core trains a few other methods with their default settings on the same data (2 on the free plan, 3 on the paid ones, inside the same task and its time) and keeps the best one that beats it; the model then has that method, and quality.second_attempt of the model says what happened. false always keeps the method asked for. Default: true.
|
hyper_search_configuration | object | Hyperparameter search (advanced). {"auto": true} searches a small grid of the main settings of the method with 3-fold cross-validation (settings fixed in configuration are not searched); the chosen values are returned in the evaluation of the model (hyperparameters). Otherwise a gimodeler search configuration: method (grid or random), cv, shuffle, random_state, number_models and grid.estimator (lists of values per setting).
|
inputs | array<integer (int32)> | Optional: the columns the model learns from, as indexes of the training source (the target cannot be one of them; repetitions are refused). Without it, every column but the target, as always. Only for 'classifier', 'regressor', 'clustering' and 'outlier', and only with an AI module that trains on chosen columns (gimodeler 0.19 or later; GET /api/v2/models/methods says so in inputs). The model keeps them in configuration.inputs: inputs of the model, predict, batch-predict, predict-1d, apply and the explanations then take exactly these columns, in the order of the source. A list with every column but the target is the same as leaving it out. With nlp_config.text_attribute, the column of text must be one of them. Errors (400): BAD_INPUTS (not a list of indexes, empty or repeated), INPUT_NOT_FOUND, INPUT_IS_TARGET, INPUTS_NOT_SUPPORTED (another type of model), INPUTS_WITHOUT_TEXT and INPUTS_NOT_AVAILABLE (the AI module of the installation cannot yet; nothing is created).
|
响应
- 200 Normal response.
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/models" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/models/{modelId}
Gets the information about a model (attributes, metrics, etc).
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
响应
- 200 Normal response
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/models/{modelId}
Modifies the name and description of a model
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
name | string | Model name (max 80 characters)
|
description | string | Model description (max 300 characters)
|
响应
- 200 Normal response
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
DELETE /api/v2/workspace/{workspaceId}/models/{modelId}
Deletes a model.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
响应
- 200 Normal response
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X DELETE "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/models/{modelId}/dependents
Dependency map of a model, to check before deleting it. sources, the sources made with its predictions (from is the source it was applied to), and dashboards, the dashboards with widgets of the model. Up to 50 of each; more counts the rest. Groups the user of the token cannot read keep their count, with hidden: true and no items.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
响应
- 200 Normal response.
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/dependents" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/models/{modelId}/evaluation
Gets the evaluation of a model.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
响应
- 200 Normal response
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/evaluation" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/models/{modelId}/predict
Uses a model to predict a value given the inputs.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
inputs 必填 | query | string | Input values given as JSON array. Example: [0.2, 0.1, -0.5, 0.9]
|
响应
- 200 Normal response
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
- 500 Internal server error or model error.
- 501 The model does not support prediction.
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/predict" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/models/{modelId}/batch-predict
Uses a model to predict a value given the inputs.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
data | array<object> | Array of instances to predict. Max 25 instances in a single request.
|
响应
- 200 Normal response
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
- 500 Internal server error or model error.
- 501 The model does not support prediction.
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/batch-predict" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/models/{modelId}/apply
Applies a model to a source: a task creates a new source with the rows of the source and a column with the prediction of each row. Without mapping, each input of the model takes the column of the source with the same name (case-insensitive).
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
source 必填 | string | Identifier of the source with the data to predict (not external or real-time).
|
name 必填 | string | Name of the new source (max 120 characters).
|
mapping | array<integer> | Optional. Column index of the source for each input of the model, in the order of the model inputs (all its fields but the target).
|
响应
- 200 Task created; poll GET /workspace/{workspaceId}/task/{taskId}: its result is the ID of the new source.
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied or plan limit
- 404 Workspace, model or source not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/apply" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/models/{modelId}/predict-1d
Unidimensional predict. Keep all the input variables with the same value and vary one of them.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
inputs | array<number> | Array of input values to provide the model with. You must provide the variable you want to vary, event it is not used, to keep the order of the variables.
|
vary | integer (int32) | Index of the input variable you want to vary
|
values | array<number> | Array of values for the input variable you want to vary. You must provide at least one value. Max values in a single request are 255.
|
响应
- 200 Normal response
- 400 Bad request
- 401 Invalid authorization
- 403 Access denied
- 404 Requested resource was not found
- 500 Internal server error or model error.
- 501 The model does not support prediction.
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/predict-1d" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/models/{modelId}/explanation
Global explanation of a classification or regression model: weight of each input in its predictions (mean absolute SHAP value over a sample of the training data). Computed by the explainability module; cached until the model changes. Requires the model_use permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
lang | query | string: es | en | Language of the text: es or en
|
stored | query | boolean | Only what is already stored: true answers the stored explanation for this version of the model, or 204 when there is none. Explanations are kept per model version (also those computed after training); the explainability module is never called.
|
响应
- 200 Normal response
- 204 No explanation stored yet (only with stored=true)
- 401 Error
- 403 ACCESS_DENIED, or XAI_DISABLED: the explainability module is not enabled for the organization of the workspace (it is enabled per organization by a global administrator)
- 404 Error
- 422 XAI_UNSUPPORTED: the model type cannot be explained (only classifiers and regressors) or its training data no longer exists
- 503 XAI_UNAVAILABLE: the explainability module is not enabled or not available
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/explanation" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/models/{modelId}/explanation/prediction
Explains one prediction: contribution of each input value (SHAP). For classifiers it explains the predicted class. Requires the model_use permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
inputs 必填 | array<object> | Input values, in the order of the model inputs (all model fields except the target)
|
lang | string: es | en | |
响应
- 200 Normal response
- 400 Error
- 401 Error
- 403 ACCESS_DENIED, or XAI_DISABLED: the explainability module is not enabled for the organization of the workspace (it is enabled per organization by a global administrator)
- 404 Error
- 422 XAI_UNSUPPORTED
- 503 XAI_UNAVAILABLE
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/explanation/prediction" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/models/{modelId}/explanation/rules
Rules that describe what a classification or regression model predicts («if … then …»; for regressors, ranges of the value), learned from its predictions over a random sample of up to 1000 rows of its training data (the same rows every time), with the coverage and precision of each rule and the fidelity of the rule list to the model. Computed by the explainability module; cached until the model changes. Requires the model_use permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
lang | query | string: es | en | Language of the text: es or en
|
stored | query | boolean | Only what is already stored: true answers the stored explanation for this version of the model, or 204 when there is none. Explanations are kept per model version (also those computed after training); the explainability module is never called.
|
响应
- 200 Normal response
- 204 No explanation stored yet (only with stored=true)
- 401 Error
- 403 ACCESS_DENIED, or XAI_DISABLED: the explainability module is not enabled for the organization of the workspace (it is enabled per organization by a global administrator)
- 404 NOT_FOUND: the workspace or the model was not found
- 422 XAI_UNSUPPORTED: only classifiers and regressors are supported, or the training data of the model no longer exists
- 429 TOO_MANY_REQUESTS: too many explanation requests; wait a minute
- 503 XAI_UNAVAILABLE: the explainability module is not enabled or not available
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/explanation/rules" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/models/{modelId}/explanation/prototypes
Representative cases (prototypes) of a random sample of up to 1000 rows of the training data of a model (the same rows every time), overall and per group: per class (classifiers), range (regressors), cluster (clustering) or anomaly / normal (anomaly detection), with how each group differs from the whole. The values of the cases are rows of the training source: they are left out (rows_hidden: true) unless the user has the read_sources permission in the workspace. Cached until the model changes. Requires the model_use permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
lang | query | string: es | en | Language of the text: es or en
|
stored | query | boolean | Only what is already stored: true answers the stored explanation for this version of the model, or 204 when there is none. Explanations are kept per model version (also those computed after training); the explainability module is never called.
|
响应
- 200 Normal response
- 204 No explanation stored yet (only with stored=true)
- 401 Error
- 403 ACCESS_DENIED, or XAI_DISABLED: the explainability module is not enabled for the organization of the workspace (it is enabled per organization by a global administrator)
- 404 NOT_FOUND: the workspace or the model was not found
- 422 XAI_UNSUPPORTED: only classifiers, regressors, clustering and anomaly detection models are supported, or the training data of the model no longer exists
- 429 TOO_MANY_REQUESTS: too many explanation requests; wait a minute
- 503 XAI_UNAVAILABLE: the explainability module is not enabled or not available
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/explanation/prototypes" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/models/{modelId}/explanation/counterfactuals
Counterfactual explanation of one case: the smallest changes of its input values that would make the model give the desired class (classifiers) or a value in the desired range (regressors), keeping the locked inputs. Up to 5 alternatives, each verified with the model. Requires the model_use permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
inputs 必填 | array<object> | Input values, in the order of the model inputs (all model fields except the target)
|
locked | array<string> | Names of inputs that may not change
|
desired_class | object | Classifiers: the wanted class (optional; any other class by default)
|
desired_range | object | Regressors (required): the wanted range of the prediction; null for no bound, at least one bound
|
count | integer | Alternatives to find
|
lang | string: es | en | |
响应
- 200 Normal response
- 400 BAD_INPUTS: the input values, the locked inputs or the desired class or range are not valid
- 401 Error
- 403 ACCESS_DENIED, or XAI_DISABLED: the explainability module is not enabled for the organization of the workspace (it is enabled per organization by a global administrator)
- 404 NOT_FOUND: the workspace or the model was not found
- 422 XAI_UNSUPPORTED: only classifiers and regressors are supported, or the training data of the model no longer exists
- 429 TOO_MANY_REQUESTS: too many explanation requests; wait a minute
- 503 XAI_UNAVAILABLE: the explainability module is not enabled or not available
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/explanation/counterfactuals" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/models/{modelId}/explanation/compare
Where two models of the same workspace disagree (interpretable model differencing): share of disagreement over a random sample of up to 1000 rows of the training data of the first model, and regions of the inputs, as readable conditions, where they differ most. Both models must be classifiers or both regressors, with the same inputs. Cached until either model changes. Requires the model_use permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
other 必填 | query | string | Identifier of the other model, of the same workspace
|
lang | query | string: es | en | Language of the text: es or en
|
stored | query | boolean | Only what is already stored: true answers the stored comparison (with other, that one; without other, the one stored last for this version of the model, whose other_model says which) or 204 when there is none. The explainability module is never called.
|
响应
- 200 Normal response
- 204 No explanation stored yet (only with stored=true)
- 401 Error
- 403 ACCESS_DENIED, or XAI_DISABLED: the explainability module is not enabled for the organization of the workspace (it is enabled per organization by a global administrator)
- 404 NOT_FOUND: the workspace or the model was not found, or `other` is not a model of the workspace
- 422 XAI_UNSUPPORTED: the models are not both classifiers or both regressors, do not have the same inputs, or the training data no longer exists
- 429 TOO_MANY_REQUESTS: too many explanation requests; wait a minute
- 503 XAI_UNAVAILABLE: the explainability module is not enabled or not available
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/explanation/compare" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/models/{modelId}/explanation/forecast
What weighs in a forecast (a model of type forecast): which past periods of a series move most what it forecasts for the next periods. The explainability module treats the forecast as a black box and forecasts again from perturbed copies of the last periods (through the AI module, gimodeler 0.17 or later) with three methods ported from IBM AIX360: TS-Saliency (integrated gradients estimated by Monte Carlo), TS-LIME (a local linear surrogate) and TS-ICE (how the forecast changes when the values of one stretch go up or down), combined in equal parts. When the chosen method is naive or seasonal naive the explanation is exact and nothing is computed. Cached until the forecast is trained again. Requires the model_use permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
series | query | string | The series to explain (its value of the series field); the first one when left out
|
lang | query | string: es | en | Language of the text: es or en
|
stored | query | boolean | Only what is already stored: true answers the stored explanation for this version of the model, or 204 when there is none. Explanations are kept per model version (also those computed after training); the explainability module is never called.
|
响应
- 200 Normal response
- 204 No explanation stored yet (only with stored=true)
- 401 Error
- 403 ACCESS_DENIED, or XAI_DISABLED: the explainability module is not enabled for the organization of the workspace (it is enabled per organization by a global administrator)
- 404 NOT_FOUND: the workspace, the model or the series was not found
- 409 FORECAST_NOT_READY: the forecast is still being trained
- 422 XAI_UNSUPPORTED: the model is not a forecast, or the AI module cannot forecast from a window (gimodeler before 0.17)
- 429 TOO_MANY_REQUESTS: too many explanation requests; wait a minute
- 503 XAI_UNAVAILABLE: the explainability module is not enabled or not available
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/explanation/forecast" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/models/{modelId}/explanation/effects
Effect of each input of a classification or regression model: one curve per input (ranges of numbers and dates, the 20 most frequent categories and «Otros») and up to 3 pairs of inputs that act together, from an Explainable Boosting Machine (InterpretML) fitted to the predictions of the model over a random sample of up to 2000 rows of its training data, with its fidelity on rows it did not see (accuracy for classification, R² for regression). For a classifier one class is explained against the rest and the effects are percentage points of its probability; for a regressor, units of the target. Computed by the explainability module; cached until the model changes. Requires the model_use permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
class | query | string | Classification: the class explained against the rest. By default the positive class of a binary task (1, true, yes, sí…) or, otherwise, the class the model predicts least often among those it predicts for at least 5 % of the rows.
|
lang | query | string: es | en | Language of the text: es or en
|
stored | query | boolean | Only what is already stored: true answers the stored explanation for this version of the model, or 204 when there is none. Explanations are kept per model version (also those computed after training); the explainability module is never called.
|
响应
- 200 Normal response
- 204 No explanation stored yet (only with stored=true)
- 401 Error
- 403 ACCESS_DENIED, or XAI_DISABLED: the explainability module is not enabled for the organization of the workspace (it is enabled per organization by a global administrator)
- 404 NOT_FOUND: the workspace or the model was not found
- 422 XAI_UNSUPPORTED: only classifiers and regressors are supported, the model does not predict the class asked for (or too few rows of it), or the training data of the model no longer exists
- 429 TOO_MANY_REQUESTS: too many explanation requests; wait a minute
- 503 XAI_UNAVAILABLE: the explainability module is not enabled or not available
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/explanation/effects" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/models/{modelId}/explanation/fairness
Bias audit (group fairness) of a classification or regression model by a sensitive field of a source (by default its training source): over a random sample of up to 5000 rows, the predictions of the model are compared with the real value of the target per group of the field (categories, or readable ranges for numbers). The field need not be an input of the model: a model that does not use it can still treat its groups differently through other inputs (indirect bias). Groups with fewer than 30 rows are reported with small: true and left out of the gaps. Verdict: concern with any flag of severity high, review with any warning (or fewer than two groups to compare), ok otherwise; the thresholds are documented in the explainability module (disparate impact below 0.8 is a warning and below 0.6 high; gaps of rates of 0.1 a warning and 0.2 high; a ratio of mean errors of 1.25 a warning and 1.5 high). Cached for an hour per model, source version, field and class. Requires the model_use and read_sources permissions.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
sensitive | string | Name of the sensitive field in the source (required unless stored is true)
|
source | string | Identifier of a source of the workspace with the inputs and the target of the model (by name); the training source by default
|
favorable | string | Classification: the favorable class. By default the positive class of a binary task or, otherwise, the least frequent real class among those with at least 5 % of the rows.
|
lang | string: es | en | |
stored | boolean | Only what is already stored: true answers the stored audit (with sensitive, that one; without it, the one stored last for this version of the model while its source has not changed) or 204 when there is none. The explainability module is never called.
|
响应
- 200 Normal response
- 204 No explanation stored yet (only with stored=true)
- 400 BAD_SENSITIVE: the sensitive field is missing, not in the source or the target of the model; BAD_CLASS: the favorable class is not one value; MODEL_NOT_SUPPORTED: only classifiers and regressors can be audited
- 401 Error
- 403 ACCESS_DENIED (the audit reads the rows of a source: it needs read_sources), XAI_DISABLED, or a refusal of the AI data policy for an AI application connected through MCP (the groups are values of the field: never sent refuses the audit, pseudonymised gives them as tokens)
- 404 NOT_FOUND: the workspace, the model or the source was not found
- 422 XAI_UNSUPPORTED: the source does not have every input of the model and its target, has no rows, or the favorable class is not a class of the target
- 429 TOO_MANY_REQUESTS: too many explanation requests; wait a minute
- 503 XAI_UNAVAILABLE: the explainability module is not enabled or not available
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/explanation/fairness" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/models/{modelId}/card
Automatic model card: training data (source, rows, inputs and types, target, missing values), method and configuration, evaluation metrics, limitations detected with heuristics (class imbalance, small sample, low metric, missing values), intended use, out-of-scope uses, creation date and author. JSON by default; format=markdown returns a Markdown document. Requires the read_models permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
format | query | string: json | markdown | Response format: json (default) or markdown
|
lang | query | string: es | en | Language of the texts: es (default) or en
|
响应
- 200 Model card
- 401 Error
- 403 Error
- 404 Error
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/card" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/forecasts
Creates a forecast of a time series: a model of type forecast that predicts the next periods of a figure from its history, with a range of likely values. Only the source and its date field are needed; the rest is automatic. It starts a task (poll GET /api/v2/workspace/{workspaceId}/task/{taskId}: its result is the ID of the model) and needs an AI module that forecasts (gimodeler 0.16; GET /api/v2/models/methods says forecast: true). If the task fails, its message is FORECAST_NOT_ENOUGH_HISTORY (fewer periods than needed, which the error description says), FORECAST_NO_DATES, FORECAST_CONSTANT or FORECAST_INTERNAL. Requires the model_create and task permissions; same plan limits as other models.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
name 必填 | string | Name of the forecast (max 120 characters).
|
description | string | Description (max 300 characters).
|
source 必填 | string | Identifier of the source with the history (not external or real-time).
|
date 必填 | string | integer | Date field of the source, by name or index.
|
target | string | integer | Numeric field to forecast, by name or index. Empty or missing to forecast the number of records.
|
series | string | integer | Optional field with categories to make one forecast per value (the 20 most frequent).
|
aggregation | string: auto | sum | mean | count | How the records of a period are combined. 'auto' (default): sum when the figure adds up by its name, else mean; count without a target.
|
frequency | string: auto | H | D | W | M | Q | Y | Period of the forecast: 'auto' (default, the rhythm of the data), H hours, D days, W weeks, M months, Q quarters, Y years.
|
horizon | integer | Periods ahead; 0 (default) is automatic: 48 hours, 30 days, 12 weeks, 12 months, 8 quarters or 5 years.
|
level | number: 0.8 | 0.95 | Coverage of the range of likely values.
|
响应
- 200 Task created; its result is the ID of the forecast model.
- 400 Bad request: FORECAST_NOT_AVAILABLE (the AI module does not forecast), BAD_NAME, BAD_DESCRIPTION, SOURCE_EXTERNAL, DATE_FIELD_MISSING, DATE_FIELD_NOT_FOUND, DATE_FIELD_NOT_DATE, TARGET_NOT_FOUND, TARGET_NOT_NUMERIC, SERIES_NOT_FOUND, SERIES_NOT_CATEGORY, BAD_AGGREGATION, BAD_FREQUENCY, BAD_HORIZON or BAD_LEVEL, with a message.
- 401 Invalid authorization
- 403 No permission (ACCESS_DENIED) or a limit of the plan (LIMIT).
- 404 Workspace or source not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/forecasts" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/models/{modelId}/forecast
The forecast of a model of type forecast, as the AI module has it: for each series (one without a series field), the next periods with the forecast value and its range, the chosen method, the seasonal pattern (in periods), the trend and the errors of the test on past data (rolling-origin backtest). history=1 adds the history (last 1,000 periods) and the test of each series. Requires the read_models permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the forecast model
|
x-auth-token 必填 | header | string | Autentication token
|
history | query | string | 1 to include the history and the test of each series
|
series | query | string | Only the series with this value of the series field
|
响应
- 200 The forecast (status 'ready'), or status 'training' or 'error' (with code and description; for NOT_ENOUGH_HISTORY, history.available and history.needed when the description says them).
- 400 The model is not a forecast (NOT_A_FORECAST).
- 401 Invalid authorization
- 403 No permission
- 404 Workspace or model not found, or the AI module does not have the forecast (FORECAST_NOT_FOUND).
- 503 The AI module is not available (AI_MODULE_UNAVAILABLE).
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/forecast" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/models/{modelId}/forecast/retrain
Trains the forecast again with the same settings and the data the source has now. The model keeps its ID, page, dashboards and saved sources; the sources made with it are updated when the new forecast is ready. Starts a task. Requires the model_edit permission (or being its owner) and the task permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the forecast model
|
x-auth-token 必填 | header | string | Autentication token
|
响应
- 200 Task created.
- 400 FORECAST_NOT_AVAILABLE, NOT_A_FORECAST, SOURCE_NOT_FOUND (the source was deleted) or a settings code when the columns of the source changed.
- 401 Invalid authorization
- 403 No permission (ACCESS_DENIED) or a limit of the plan (LIMIT).
- 404 Workspace or model not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/forecast/retrain" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/models/{modelId}/forecast/source
Saves the forecast as a data source with the columns date, series (only with a series field), forecast, lower and upper. It is a derived source of the model: it is updated each time the forecast is trained again. Starts a task (its result is the ID of the source). Requires the model_use, source_create and task permissions; counts towards the sources of the plan.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the forecast model
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
name 必填 | string | Name of the new source (max 120 characters).
|
响应
- 200 Task created.
- 400 NOT_A_FORECAST or BAD_NAME.
- 401 Invalid authorization
- 403 No permission (ACCESS_DENIED) or a limit of the plan (LIMIT).
- 404 Workspace or model not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/forecast/source" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/genai-models
Lists the models with generative AI of a workspace: the user described what to predict from one to five sources, and generative AI predicts it row by row. Requires the read_models permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
page | query | integer | |
limit | query | integer | |
x-auth-token 必填 | header | string | Autentication token
|
响应
- 200 The models (the cases of their checks left out).
- 401 Invalid authorization
- 404 Workspace or model not found (NOT_FOUND)
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/genai-models" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/genai-models
Plans a model with generative AI from a description and one to five sources. The model only sees a profile of each source (schema, statistics and at most 30 sample rows, long texts cut): a small fixed cost (plan_estimate_eur of the config), whatever the size of the data; nothing is spent on the rows. The plan is kept only as far as it fits the sources (dropped says what was left out) and can be corrected with POST .../genai-models/{genaiModelId}. Requires the model_create permission. On the free plan only the cost-free model of the platform or the organization's own key can be used (403 GENAI_PLAN_REQUIRED).
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
description 必填 | string | What to predict, in the user's words.
|
sources 必填 | array<string> | Identifiers of the sources (the first one is a good main source).
|
name | string | Name; otherwise the AI proposes one.
|
lang | string | Language of the plan and of the reasons (es, en, cat, fr...).
|
响应
- 200 The model and its plan.
- 400 BAD_DESCRIPTION, BAD_SOURCES, or the text was not accepted (REQUEST_NOT_ALLOWED...).
- 401 Invalid authorization
- 403 GENAI_PLAN_REQUIRED, LIMIT (models per workspace) or a spending limit of the AI.
- 404 Workspace or model not found (NOT_FOUND)
- 422 NOT_UNDERSTOOD: no plan could be made from the description.
- 429 Too many requests or a spending limit (SPEND_LIMIT, ORG_SPEND_LIMIT).
- 503 ASSISTANT_DISABLED or MODEL_UNAVAILABLE.
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/genai-models" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/genai-models/config
Whether models with generative AI can be used here (available, else code: ASSISTANT_DISABLED or GENAI_PLAN_REQUIRED), the AI model (cost_free, own_key), the fixed cost of a plan, the default spending limit of a run, the limits and what the user may do. Requires the read_models permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Autentication token
|
响应
- 200 The configuration.
- 401 Invalid authorization
- 404 Workspace or model not found (NOT_FOUND)
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/genai-models/config" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/genai-models/{genaiModelId}
A model with generative AI: its plan, its last check (with its result) and its last run (with why it stopped and the source of the predictions). While a check or a run is in progress, read it every few seconds: it catches up with its task. Requires the read_models permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
genaiModelId 必填 | path | string | Identifier of the model with generative AI
|
x-auth-token 必填 | header | string | Autentication token
|
响应
- 200 The model.
- 401 Invalid authorization
- 404 Workspace or model not found (NOT_FOUND)
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/genai-models/<genaiModelId>" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/genai-models/{genaiModelId}
Corrects the plan (only the keys sent; it is checked again against the sources as the plan of the AI), the name or the description. No cost. Requires the model_edit permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
genaiModelId 必填 | path | string | Identifier of the model with generative AI
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
plan | object | The keys of the plan that change: question, task, answers, inputs, past_answers (or null), guidance, number_range.
|
name | string | |
description | string | |
响应
- 200 The model, what was left out and a new estimate.
- 400 BAD_PLAN, BAD_SOURCES or a text that was not accepted.
- 401 Invalid authorization
- 404 Workspace or model not found (NOT_FOUND)
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/genai-models/<genaiModelId>" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
DELETE /api/v2/workspace/{workspaceId}/genai-models/{genaiModelId}
Deletes the model; the source of its predictions stays. Requires the model_delete permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
genaiModelId 必填 | path | string | Identifier of the model with generative AI
|
x-auth-token 必填 | header | string | Autentication token
|
响应
- 200 Deleted.
- 401 Invalid authorization
- 404 Workspace or model not found (NOT_FOUND)
示例
curl -X DELETE "https://app.air-core.io/api/v2/workspace/<workspaceId>/genai-models/<genaiModelId>" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/genai-models/{genaiModelId}/estimate
What each paid step would cost, in charged euros, from counts and a small sample (the data is never read whole): the check on up to 100 rows with a known answer, and the apply with the limits of the run. Zero with the cost-free model or the organization's own key. Spends nothing. Requires the read_models permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
genaiModelId 必填 | path | string | Identifier of the model with generative AI
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
max_eur | number | Spending limit of the run in charged euros (default: what is left of the AI credits or monthly caps of the user and the organization, at most 5).
|
max_rows | integer | Maximum rows sent to the model in the run (default 20000).
|
only_missing | boolean | Only the rows without a known answer (default true when the plan has a field of known answers).
|
响应
- 200 The estimate.
- 401 Invalid authorization
- 404 Workspace or model not found (NOT_FOUND)
- 409 PLAN_NOT_READY or SOURCE_MISSING.
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/genai-models/<genaiModelId>/estimate" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/genai-models/{genaiModelId}/check
Checks the plan, as a task: predicts up to 100 rows that already have the answer (stratified by answer, without seeing it), with a few others as examples, and measures the hit rate or the error next to a simple rule. A paid step: it runs only with the estimate_id of the check the user accepted, or confirm_eur. Requires the model_create or model_edit permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
genaiModelId 必填 | path | string | Identifier of the model with generative AI
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
estimate_id | string | The estimate_id of the step, from the estimate the user accepted.
|
confirm_eur | number | Instead of estimate_id: an amount in euros the user accepted, at least the payable_eur of the step now.
|
max_eur | number | Spending limit of the run in charged euros (default: what is left of the AI credits or monthly caps of the user and the organization, at most 5).
|
响应
- 200 Task created (poll GET .../genai-models/{genaiModelId}, which catches up with the task).
- 401 Invalid authorization
- 403 GENAI_PLAN_REQUIRED, LIMIT (task time or parallel tasks) or a spending limit.
- 404 Workspace or model not found (NOT_FOUND)
- 409 ESTIMATE_NOT_CONFIRMED (409): the step was not confirmed or its cost changed; `details.estimate` has the current estimate to show to the user and confirm again. Also NO_PAST_ANSWERS (fewer than 20 known answers), PLAN_NOT_READY, PLAN_OUTDATED, SOURCE_MISSING or RUN_IN_PROGRESS.
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/genai-models/<genaiModelId>/check" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/genai-models/{genaiModelId}/apply
Applies the model to the rows of the main source, as a task: many rows per call, every answer validated against the plan, answers cached by row content (a refresh pays only for new or changed rows), and the limits of the run checked before every call: it stops cleanly at the first one and keeps what it got. The first run creates a source with the predictions, a one-sentence reason and a status per row; the next ones replace it. A paid step: send the estimate_id of the apply the user accepted with the same max_eur, max_rows and only_missing, or confirm_eur. Requires the source_create permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
genaiModelId 必填 | path | string | Identifier of the model with generative AI
|
x-auth-token 必填 | header | string | Autentication token
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
estimate_id | string | The estimate_id of the step, from the estimate the user accepted.
|
confirm_eur | number | Instead of estimate_id: an amount in euros the user accepted, at least the payable_eur of the step now.
|
max_eur | number | Spending limit of the run in charged euros (default: what is left of the AI credits or monthly caps of the user and the organization, at most 5).
|
max_rows | integer | Maximum rows sent to the model in the run (default 20000).
|
only_missing | boolean | Only the rows without a known answer (default true when the plan has a field of known answers).
|
name | string | Name of the source of the predictions (first run).
|
响应
- 200 Task created (poll GET .../genai-models/{genaiModelId}, which catches up with the task).
- 401 Invalid authorization
- 403 GENAI_PLAN_REQUIRED, LIMIT (sources, task time or parallel tasks) or a spending limit.
- 404 Workspace or model not found (NOT_FOUND)
- 409 ESTIMATE_NOT_CONFIRMED (409): the step was not confirmed or its cost changed; `details.estimate` has the current estimate to show to the user and confirm again. Also NO_ROWS, PLAN_NOT_READY, PLAN_OUTDATED, SOURCE_MISSING or RUN_IN_PROGRESS.
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/genai-models/<genaiModelId>/apply" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/models/{modelId}/monitoring
The monitoring of a model in production («Seguimiento»): whether it is on (on by default for the models trained after the feature existed, off for the older ones until a person turns it on), its settings, the sources it can watch (the training source and the origins of the sources the model is applied to), the reference profile of its training data (exact: from the exact version the model was trained on, kept by the version history of the source; approximate: that version is gone and the current one was used) with, per input and target, the fixed edges of its bins (numbers and dates: about ten bins with about the same rows, chosen among 200 bins of equal width) or its 20 most frequent values plus «others», and the shares of rows of each bucket; its status (stable, watch, alert, pending before its first run, off), the last run in full (per source watched and column: the PSI against the reference with the same edges, its status and the shares of each bucket now; and the quality with the real outcomes of the rows added after training: the main metric now against the one of the training, or a code saying why it was not measured, e.g. SCORE_UNAVAILABLE with a gimodeler without /score) and the summary of the latest runs for the trend. PSI = Σ (a − e) · ln(a / e) over the buckets (empty values, under the first edge, each bin, over the last edge; or empty values, each value, others), shares of 0 taken as 0.0001; a column is watch from psi_warning (0.10) and alert from psi_alert (0.25); dates do not count in the status unless include_dates. The watcher runs it after the updates of the sources watched, at most once a day. An AI application connected through MCP needs the level «aggregates» and gets the values of the categories and the edges of the bins only for columns without personal data held back (withheld_for_ai). Needs a token that reads workspaces and permission to read the models.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 The monitoring of the model
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or model not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/monitoring" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
PUT /api/v2/workspace/{workspaceId}/models/{modelId}/monitoring
Turns the monitoring of a model on or off and changes its settings (only what is sent changes). Turning it on, or changing what is compared, takes the reference when there is none and runs it now: the answer waits up to 20 seconds (running: true when it goes on in the background). alert turns the alert of the model on or off (an alert of the workspace of type «model»: it fires when a run newly reaches «alert», never on the first run nor again while it stays; needs permission to edit the workspace). check: true runs it now. Classifiers, regressors, clusterings and outlier detectors can be monitored. Needs a token that writes workspaces and permission to edit the model (or to own it). Answers the monitoring as GET does.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
enabled | boolean | |
settings | ModelMonitoringSettings | |
alert | object | |
check | boolean | true: run it now
|
响应
- 200 The monitoring of the model
- 400 BAD_REQUEST, BAD_SETTINGS, UNKNOWN_KEY, BAD_THRESHOLD, BAD_SOURCES, UNKNOWN_SOURCE, NO_SOURCES or UNSUPPORTED_MODEL
- 401 Invalid authorization
- 403 Access denied (ACCESS_DENIED: without permission to edit the model, or the workspace for `alert`), or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or model not found
- 409 TRAINING_SOURCE_MISSING (an alert for a model without its training source)
示例
curl -X PUT "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/monitoring" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/models/{modelId}/monitoring/check
Runs the monitoring of a model now (the answer waits up to 20 seconds; running: true when it goes on in the background). Asked again within a minute with nothing changed, it answers the last run. Needs a token that writes workspaces and permission to edit the model (or to own it). Answers the monitoring as GET .../monitoring does.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
响应
- 200 The monitoring of the model
- 400 MONITORING_OFF (turn it on first) or UNSUPPORTED_MODEL
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or model not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/monitoring/check" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/models/{modelId}/versions
The versions of a model, the newest first. A model keeps its ID, page, dashboards and sources while the trained engine behind it can change: status says which version is in use (active), waits to be promoted (candidate), was in use and is kept to go back to it (previous: the last 2), failed, or is no longer kept (retired). Each one has its trigger (initial: the one the model was created with; manual: retrained by a person; retrain: retrained by AIR-Core), when and who, its metrics (numbers only, never the classes), the data it learned from (training_data: the source and its version, whether that version is the current one and whether it is kept in the history of the source), how it compared with the version in use when it was trained (comparison: basis same_rows when both were measured on the same rows, the holdout of the current version of the source, with gimodeler 0.20 and its /score; own_evaluation when each one was measured on its own test rows, indicative only; metric, delta, relative, better (at least 1 % better), baseline), its note and can_promote. retrain says whether the model can be retrained now (problem: why not, e.g. SOURCE_COLUMNS_CHANGED), whether a retraining is running (running: its task) and whether candidates are compared on the same rows (same_rows); a forecast is always replaced when retrained (promotion: always). Models without stored versions list the one they were created with. Requires the read_models permission. For an AI application connected through MCP, the gate «aggregates» of the AI data policy, and notes in which the detector of personal data finds some are withheld (note_withheld).
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 {result: success, model, type, active, keep_previous: 2, min_gain: 0.01, versions: [{version, status, trigger, created, author: {uid, name}, metrics, size, training_data: {source, source_name, version, at, current, kept}, comparison, note, task, promoted, replaced, can_promote}], retrain: {supported, promotion, available, running, problem, same_rows}, can_retrain, can_promote}
- 401 Invalid authorization
- 403 Access denied, or AI_POLICY_* for an AI application
- 404 Workspace or model not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/versions" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/models/{modelId}/retrain
Retrains the model with the same configuration (method, settings, chosen columns, train/test split) and the data its source has now (classifiers and regressors; a forecast gets the retraining of POST …/forecast/retrain, which always replaces it). The new version is a candidate, compared with the version in use, and nothing changes until it is promoted; with auto_promote: true it is promoted by itself when, measured on the same rows, its main metric (F1 macro or accuracy for a classifier, R² for a regressor) is at least 1 % better. The last 2 versions in use and the newest candidate are kept; their size counts in the workspace. Starts a task (its result is the ID of the model); its time counts like any training. Requires the model_edit permission (or being the owner of the model) and the task permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
auto_promote | boolean | Promote it by itself when it is at least 1 % better on the same rows (default false: it stays a candidate)
|
note | string | A note for the history
|
lang | string: es | en | Language of the texts of the task
|
响应
- 200 {result: success, task, task_id}
- 400 BAD_REQUEST, BAD_NOTE, RETRAIN_NOT_SUPPORTED, SOURCE_NOT_FOUND, SOURCE_EXTERNAL, SOURCE_COLUMNS_CHANGED (the columns of the source changed since the model was trained: details.columns), METHOD_NOT_AVAILABLE, INPUTS_NOT_AVAILABLE or a settings code of a forecast
- 401 Invalid authorization
- 403 ACCESS_DENIED, or a limit of the plan (LIMIT)
- 404 Workspace or model not found
- 409 RETRAIN_RUNNING (details.task)
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/retrain" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
POST /api/v2/workspace/{workspaceId}/models/{modelId}/versions/{version}/promote
Makes a version the one in use: a candidate, or a previous one to go back to it. One write of the model (its engine, evaluation, columns, size and version of the source), only if the model did not change meanwhile; the version that was in use is kept to go back to it, and the sources made by applying the model are computed again. Requires the model_edit permission (or being the owner of the model).
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
version 必填 | path | integer | The version to use, as GET …/versions gives it
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
响应
- 200 {result: success, model, active, previous}
- 400 VERSION or NOT_PROMOTABLE (forecasts and unsupervised models)
- 401 Invalid authorization
- 403 ACCESS_DENIED
- 404 Workspace or model not found, or VERSION_NOT_FOUND
- 409 VERSION_ACTIVE, VERSION_GONE (its engine is no longer kept) or CONFLICT (the model changed meanwhile)
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/versions/<version>/promote" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/model-experiments
The comparisons of methods («Comparar métodos») of a workspace, the newest first (at most 50): their status, the methods of their candidates, the recommended candidate, whether a winner can still be picked (can_choose) and until when (expires), and the model the winner became. With model, only those started from that model or won by it; with source, only those of that source. options says what a comparison can have here: the candidates of the plan (2 to 3 on the free plan, up to 10 on the paid plans), the methods, whether candidates can learn from chosen columns, and who measures the naive prediction (ai-module with an AI module that learns it, platform otherwise). Needs a token that reads workspaces and permission to read the models.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
model | query | string | Only the comparisons started from this model or won by it
|
source | query | string | Only the comparisons of this source
|
响应
- 200 The comparisons and what one can have
- 401 Invalid authorization
- 403 Access denied
- 404 Workspace not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/model-experiments" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/model-experiments
Starts a comparison of methods: several candidates that predict the same target of a source, trained one after the other in one task (one stage per candidate) on the same data and the same split (the same test_size, shuffle and seed for all; when no seed is given, one is drawn and used for all), each one a method with its default settings or the automatic search of its settings, and optionally other input columns. A candidate that fails does not stop the others, and the task stops starting candidates when the task time of the organization runs out. Each candidate is compared with the naive prediction (the most frequent class, or the mean): measured on the same rows by an AI module that learns it, or computed by AIR-Core from the evaluation otherwise. The candidates are not models: when the task ends, read the comparison and pick the winner (POST .../winner); candidates nobody picks are deleted after 7 days. Classifiers and regressors only; 2 to 3 candidates on the free plan, up to 10 on the paid plans. Answers the comparison and its task (the task gives the comparison in result). Needs a token that writes workspaces and permission to create models and run tasks.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
name 必填 | string | The name the winner will have
|
description | string | The description the winner will have
|
source 必填 | string | Training source
|
target 必填 | integer | Index of the target field
|
type | string: classifier | regressor | Without it, regressor for a numeric target and classifier otherwise
|
candidates 必填 | array<ModelExperimentCandidateRequest> | |
training_configuration | object | The split shared by every candidate
|
scaling | object | Scaling of the inputs, as in the creation of a model (count-based naive Bayes candidates get minmax instead of standard or robust)
|
feature_selection | object | Feature selection, as in the creation of a model
|
nlp_config | object | Text classifiers: the column of text and its settings, as in the creation of a model
|
from_model | string | The model the comparison starts from («Try other methods with this data»), to link them
|
lang | string: es | en | Language of the explanations of the winner
|
响应
- 200 The comparison and its task
- 400 BAD_NAME, BAD_DESCRIPTION, BAD_TYPE, BAD_CANDIDATES, TOO_FEW_CANDIDATES, TOO_MANY_CANDIDATES (details.limit), DUPLICATE_CANDIDATE, UNKNOWN_METHOD, METHOD_NOT_AVAILABLE, BAD_INPUTS, INPUT_NOT_FOUND, INPUT_IS_TARGET, INPUTS_WITHOUT_TEXT, INPUTS_NOT_AVAILABLE, BAD_SPLIT or SOURCE_EXTERNAL
- 401 Invalid authorization
- 403 Access denied, or LIMIT (size, task time or parallel tasks of the plan)
- 404 Workspace, source (SOURCE_NOT_FOUND) or target (TARGET_NOT_FOUND) not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/model-experiments" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/model-experiments/{experimentId}
A comparison of methods: its status (pending, running, done = waiting for a choice, chosen, expired, failed, history = imported), the shared split, and per candidate its method and settings, its columns, its status (and the error of one that failed), its metrics (classifier: accuracy and f1, macro average; regressor: r2 and mae), those of the naive prediction (baseline, with source: ai-module or platform), the gain over it in the main metric, how much smaller its error is (regressors, when known), the training time and the size. primary_metric is the figure they are compared by (r2; accuracy, or f1 when the classes of the test rows are unbalanced); recommended is the candidate with the best one, ties (less than half a point) going to the simpler method and then to the faster one (recommended_reason: best, tie_simpler, tie_faster, only); beats_baseline false means no candidate beats the naive prediction. An AI application connected through MCP never gets the class the naive prediction answers. Needs a token that reads workspaces and permission to read the models.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
experimentId 必填 | path | string | Identifier of the comparison
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 The comparison
- 401 Invalid authorization
- 403 Access denied, or the AI data policy refuses it (AI_POLICY_*)
- 404 Workspace or comparison not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/model-experiments/<experimentId>" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/model-experiments/{experimentId}/winner
Picks the winner of a finished comparison (status done): the candidate becomes a normal model, with the identifier it has in the AI module, its configuration, its evaluation and the fields of the source when it was trained, and the other candidates are deleted from the AI module (they were never models). Picking the same candidate again answers the same model. Needs a token that writes workspaces and permission to create models.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
experimentId 必填 | path | string | Identifier of the comparison
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
candidate 必填 | string | Key of the candidate (c1, c2...)
|
响应
- 200 The model the winner became
- 401 Invalid authorization
- 403 Access denied, or LIMIT (size of the plan)
- 404 Workspace or comparison not found, or CANDIDATE_NOT_FOUND
- 409 NOT_FINISHED, ALREADY_CHOSEN (another candidate was picked), CANDIDATE_NOT_TRAINED, CANDIDATES_EXPIRED (not picked in 7 days) or NO_CANDIDATES
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/model-experiments/<experimentId>/winner" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/models/{modelId}/retrain-schedule
The automatic retraining of a classifier or a regressor («Reentrenamiento automático»; a forecast keeps its own retraining: supported: false). mode: off (never by itself: the default of every model, also the existing ones), schedule (every day, week or month in a window of hours, in the time zone of the organization or its own timezone), data (when the training source has at least min_new_rows new rows, or min_growth more rows as a share, since the data the version in use learned from: its source version), drift (when the monitoring of the model reaches «alert»). timezone is the one in use, next_run when the window starts next (schedule) or when the condition is looked at again (data, drift), last_started and last_task the last retraining it started, last_result and history what happened: started, skipped (reason: SOURCE_COLUMNS_CHANGED, RETRAIN_RUNNING, LIMIT, SOURCE_UNCHANGED, ONCE_A_DAY or another code of the retraining; the same skip again is counted in count), candidate (the new version waits for a person; reason why it was not promoted by itself: auto_off, not_same_rows, not_enough, worse), promoted (by itself, with version, previous to go back to it with POST …/versions/{previous}/promote, and the comparison) or failed; catch_up when it ran after the platform missed its window (once, never once per window missed). state gives each condition now: data (base_rows, rows, new_rows, growth, changed, met) and monitoring (enabled, status). At most one retraining by itself a day per model; each one is a task whose time counts like any training, within the limits of the plan. same_rows says whether the AI module measures both versions on the same rows (needed to promote by itself). Requires the read_models permission. For an AI application connected through MCP, the gate «aggregates» of the AI data policy, without who set it up.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 The schedule of the model
- 401 Invalid authorization
- 403 Access denied, or AI_POLICY_* for an AI application
- 404 Workspace or model not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/retrain-schedule" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
PUT /api/v2/workspace/{workspaceId}/models/{modelId}/retrain-schedule
Changes the automatic retraining of a classifier or a regressor: only what is sent changes. With auto_promote: true a new version is promoted by itself only when it was measured on the same rows as the version in use (gimodeler 0.20 with /score; never on each version's own evaluation) and its main metric (F1 macro or accuracy for a classifier, R² for a regressor) improves at least min_gain (a share: 0.01 = 1 %, the default; 0 or more); otherwise it waits as a candidate, with a notice in the bell of the owner and of who set it up, the activity of the workspace and, when the owner has the emails of alerts on, an email. Every automatic promotion is written down with its comparison and can be undone with POST …/versions/{version}/promote. Requires the model_edit permission (or being the owner of the model) and the task permission. Answers the schedule as GET does.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
mode | string: off | schedule | data | drift | |
settings | ModelRetrainScheduleSettings | |
响应
- 200 The schedule of the model
- 400 BAD_REQUEST, UNKNOWN_KEY, BAD_MODE, BAD_SETTINGS, BAD_EVERY, BAD_WEEKDAY, BAD_DAY, BAD_HOUR, BAD_TIMEZONE, BAD_NEW_ROWS, BAD_GROWTH, NO_CONDITION (mode data without min_new_rows nor min_growth), BAD_AUTO_PROMOTE, BAD_MIN_GAIN or UNSUPPORTED_MODEL (forecasts and unsupervised models)
- 401 Invalid authorization
- 403 ACCESS_DENIED, or AI_POLICY_* for an AI application
- 404 Workspace or model not found
示例
curl -X PUT "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/retrain-schedule" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/models/{modelId}/trust-report
Trust report of a model, to help document it as an AI system (Regulation (EU) 2024/1689): intended purpose (written by the organization), data used (source, version, rows, columns and the personal data found, as field names and kinds, never values), method, evaluation and quality verdict, global importance of the inputs, known limits, monitoring and drift, versions, who changed what, human oversight (written by the organization) and where it runs. The risk category is the one the organization chose in its register of AI systems; the platform does not classify. It does not certify compliance and is not legal advice. JSON by default; format=markdown returns a Markdown document and format=pdf a PDF (an HTML document, with the header X-Report-Format: html, when the installation cannot print PDF). Read only. Requires the read_models permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
modelId 必填 | path | string | Identifier of the model
|
x-auth-token 必填 | header | string | Autentication token
|
format | query | string: json | markdown | pdf | Response format: json (default), markdown or pdf
|
lang | query | string: es | en | Language of the texts: es (default) or en
|
响应
- 200 Trust report
- 401 Error
- 403 Error
- 404 Error
- 503 Too many PDF documents are being prepared (PDF_BUSY); try again after Retry-After
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/models/<modelId>/trust-report" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
GET /api/v2/workspace/{workspaceId}/flows
«Flujos»: the flows of the workspace (decisions that run by themselves: when a source is updated or every N hours, retrain a model when due, predict the new rows, evaluate a condition and act by email, signed webhook or rows written to another source), newest change first, each with last_outcome (the status of its last run). Requires the read permission. For an AI application connected through MCP, the gate «structure» of the AI data policy, without who made or changed them.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 The flows
- 401 Invalid authorization
- 403 Access denied, or AI_POLICY_* for an AI application
- 404 Workspace not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/flows" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/flows
Creates a flow, off unless enabled: true (switched on, the rows the source has then do not count as new). retrain: never, if_due (when the training source has data the model did not learn from, at most once a day) or always; the retraining is the task of «Versiones» and the new version is used only when its quality verdict is not not_better_than_naive and not worse than the version in use (nor worse on the same rows); otherwise the version in use is kept, the new one waits as a candidate, the owner is told and the run ends guarded without acting. condition: all, rules (on the columns of the source and the columns the model adds, such as <target>_predicted and <target>_predicted_probability; the operators of the simple notices) or alert (a simple notice of the trigger source). At most 3 actions, one of each type: email (to: me, members or list: the notice list of the workspace, all of it or the entries in recipients, with the checks of the simple notices), webhook (url: https and public only; JSON event flow.fired signed with HMAC-SHA256 in x-signature-256, as the webhooks of the simple notices) and append (target: a source of the workspace that can be edited; columns taken by name, flow_run_at gets the time of the run). Limits: 2 flows per workspace on the free plan (20 on paid plans), 4 runs per flow and hour, 10 tests per hour, 5 runs with actions a day on the free plan (48 on paid), 1000 rows predicted per run. Requires the ws_edit and task permissions. Answers the flow; webhook_secret only when one was made (shown once).
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
name | string | |
description | string | |
enabled | boolean | |
trigger | object | |
model | string | A classifier, regressor, clustering or outlier model of the workspace; empty: the condition is on the data only
|
retrain | string: never | if_due | always | |
condition | object | |
actions | array<object> | |
rotate_secret | boolean | |
响应
- 200 The flow
- 400 BAD_REQUEST, UNKNOWN_KEY, BAD_NAME, BAD_TRIGGER, BAD_SCHEDULE, BAD_RETRAIN, BAD_CONDITION, BAD_ACTIONS, BAD_RECIPIENTS, LIST_EMPTY, RECIPIENT_NOT_FOUND, SOURCE_NOT_FOUND, MODEL_NOT_FOUND, MODEL_NOT_SUPPORTED, INPUTS_MISSING, ALERT_NOT_FOUND, TARGET_NOT_FOUND, TARGET_NOT_EDITABLE, WEBHOOK_URL_INVALID, WEBHOOK_PRIVATE_ADDRESS, WEBHOOK_PORT_NOT_ALLOWED or WEBHOOK_HOST_NOT_ALLOWED
- 401 Invalid authorization
- 403 ACCESS_DENIED, LIMIT (flows of the plan), or AI_POLICY_* for an AI application
- 404 Workspace not found
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/flows" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/flows/{flowId}
A flow and its latest runs (runs: how many, 20 by default, 50 at most), each with what every step did (counts, never rows). The webhook is given by its origin only. Requires the read permission. For an AI application connected through MCP, the gate «aggregates».
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
flowId 必填 | path | string | Identifier of the flow
|
runs | query | integer | |
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 The flow and its runs
- 401 Invalid authorization
- 403 Access denied, or AI_POLICY_* for an AI application
- 404 Workspace or flow not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/flows/<flowId>" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
PUT /api/v2/workspace/{workspaceId}/flows/{flowId}
Changes a flow: only what is sent changes, and every change is a new version (the previous ones are kept in history). rotate_secret: true makes a new signing secret for the webhook (answered once). Requires the ws_edit and task permissions.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
flowId 必填 | path | string | Identifier of the flow
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
请求正文 application/json
| 字段 | 类型 | 描述 |
|---|
name | string | |
description | string | |
enabled | boolean | |
trigger | object | |
model | string | A classifier, regressor, clustering or outlier model of the workspace; empty: the condition is on the data only
|
retrain | string: never | if_due | always | |
condition | object | |
actions | array<object> | |
rotate_secret | boolean | |
响应
- 200 The flow
- 400 The codes of POST …/flows
- 401 Invalid authorization
- 403 ACCESS_DENIED, or AI_POLICY_* for an AI application
- 404 Workspace or flow not found
示例
curl -X PUT "https://app.air-core.io/api/v2/workspace/<workspaceId>/flows/<flowId>" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG" \
-H "Content-Type: application/json" -d @body.json
GET /api/v2/workspace/{workspaceId}/flows/{flowId}/runs
The runs of a flow, newest first (limit, 50 at most; the last 50 are kept). Requires the read permission.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
flowId 必填 | path | string | Identifier of the flow
|
limit | query | integer | |
x-auth-token 必填 | header | string | Authentication token (reads workspaces)
|
响应
- 200 The runs
- 401 Invalid authorization
- 403 Access denied, or AI_POLICY_* for an AI application
- 404 Workspace or flow not found
示例
curl -X GET "https://app.air-core.io/api/v2/workspace/<workspaceId>/flows/<flowId>/runs" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"
POST /api/v2/workspace/{workspaceId}/flows/{flowId}/test
«Probar ahora»: goes through the flow with the new rows of its source (or, when there are none, its last 20 rows) and tells what each step would do (would_run, would_send, would_write), without starting a retraining, sending or writing anything. Recorded as a run with dry_run: true. preview: the first rows that meet the condition (left out for an AI application). At most 10 tests per flow and hour (429 RATE_LIMIT). Requires the ws_edit and task permissions.
参数
| 名称 | 位置 | 类型 | 描述 |
|---|
workspaceId 必填 | path | string | Identifier of the workspace
|
flowId 必填 | path | string | Identifier of the flow
|
x-auth-token 必填 | header | string | Authentication token (writes workspaces)
|
响应
- 200 The test
- 401 Invalid authorization
- 403 ACCESS_DENIED, or AI_POLICY_* for an AI application
- 404 Workspace or flow not found
- 429 RATE_LIMIT
示例
curl -X POST "https://app.air-core.io/api/v2/workspace/<workspaceId>/flows/<flowId>/test" \
-H "x-auth-token: $AIRCORE_TOKEN" \
-H "x-organization: $AIRCORE_ORG"