API Sources
API sources read a REST response and can page through it with one of four pagination strategies.
Providers: rest
Asset fields
Every asset in this type carries these fields; provider and format values live under options.
| Field | Type | Default | Notes |
|---|---|---|---|
name (required) | string | - | - |
chain | object | - | Per-row iteration over a previously loaded asset. When set, offset is not allowed. |
chain.from (required) | string | - | FQN of a previous asset whose distinct rows drive per-row iteration (e.g. sources.source_name.asset_name). |
chain.pass_columns (required) | boolean | - | When true, prepend the parent row's columns onto every result row produced by that chained iteration. |
chain.prepend_label | string | - | Optional prefix concatenated onto passed parent column names to avoid name conflicts (e.g. 'right_'). |
url (required) | string | - | - |
method (required) | GET or POST or PUT or PATCH | - | - |
schema | string | - | Optional DDL schema definition for api-based sources. Format: 'field1 type1, field2 type2, ...' or multi-line string for better readability. |
offset | object | - | - |
offset.key (required) | string | - | - |
offset.response_key | string | - | - |
offset.initial_value (required) | string | - | Initial offset value. |
offset.type (required) | timestamp or datetime or date or integer or int or long or id or string or text or cursor or token or page | - | - |
offset.format | string | - | Optional target format used to reformat the value extracted from response_key so it matches the requestParam format expected by the API. Applied only when type is 'timestamp' or 'integer'. For timestamp: 'iso8601' (default), 'epoch_millis', 'epoch_seconds', or any DateTimeFormatter pattern (e.g. 'yyyy-MM-dd'). For integer: any java.util.Formatter pattern (e.g. '%d', '%08d', '%x'). |
downloadable_files | object | - | When present, switches to file-download mode. By default the asset url is a listing endpoint and each JSON response item must contain a downloadable file URL. With 'direct_download: true' the asset url response body is the file itself. Downloaded files are read into Spark as a single DataFrame, or returned as a metadata DataFrame when 'files_reading' is false. |
downloadable_files.direct_download | boolean | false | If true, the asset url response body IS the file itself - no listing JSON is parsed and 'url_field'/'name_field' are not used. Works with asset chaining: the url may contain {{column}} placeholders, and one file is downloaded per resolved url. |
downloadable_files.file_name | string | - | Only for 'direct_download'. Name to give the downloaded file. Supports {{column}} placeholders resolved from the parent asset in chained mode (e.g. "{{name}}" or "{{id}}.csv"). If omitted, the name is taken from the Content-Disposition response header, then the last url path segment, then a generated name. |
downloadable_files.files_reading | boolean | true | If true, reads downloaded files into a DataFrame using the specified 'format' and 'schema'. If false, returns a DataFrame with file metadata (e.g., original URL, filename, local path) without reading file contents. |
downloadable_files.downloading_directory | string | - | Local directory for downloading files. If not specified, a system temp directory is used. |
downloadable_files.ignore_missing_files | boolean | false | When true, a missing remote file does not fail the run. In metadata mode (files_reading: false) a row is still emitted with original_url set and local_path null so missing files can be identified later. Default false. |
downloadable_files.url_field | string | - | Field name in each response item containing the pre-authenticated download URL. Can be a JsonPointer path like '/results/0/value/url'. |
downloadable_files.name_field | string | - | Field name in each response item containing the filename. Used with 'pattern' for glob filtering. Can be a JsonPointer path like '/results/0/value/name'. |
downloadable_files.pattern | string | - | Glob pattern applied to name_field. Only matching files are downloaded. Omit to download all items. |
downloadable_files.format | csv or json or parquet or orc or text or excel | - | Spark read format for the downloaded files. |
downloadable_files.schema | string | - | Explicit schema for the downloaded files (e.g., 'field1 type1, field2 type2, ...'). Optional. |
downloadable_files.read_options | object | - | Options passed to the Spark reader. Valid keys depend on the format. |
Minimal example
A complete api source with one asset, written for provider rest:
Code
Providers
rest
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
http_version | HTTP_1_1 or HTTP_2 or HTTP_3 | HTTP_2 | HTTP version to use for the API request. |
ssl_verify | boolean | true | Verify TLS certificates. Set to false to disable certificate and hostname validation (dev/testing only; applies to every call made through this connection, including chained file downloads). |
auth is one of:
OAuth2 (client credentials)
| Field | Type | Default | Notes |
|---|---|---|---|
type (required) | oauth2 | - | - |
credentials (required) | object | - | - |
credentials.token_url (required) | string | - | Token endpoint URL (e.g. https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token). |
credentials.client_id (required) | string | - | OAuth2 application (client) ID. |
credentials.client_secret (required) | string | - | OAuth2 client secret. |
credentials.client_secret_method | basic or post | basic | Client auth method: basic (default) or body. |
credentials.scope | string | - | Scope string (e.g. 'https://graph.microsoft.com/.default'). |
credentials.token_field | string | access_token | Field in the token response that holds the access token. Defaults to 'access_token'. |
Bearer token
| Field | Type | Default | Notes |
|---|---|---|---|
type (required) | bearer | - | - |
credentials (required) | object | - | - |
credentials.token (required) | string | - | Static bearer token. |
Basic auth
| Field | Type | Default | Notes |
|---|---|---|---|
type (required) | basic | - | - |
credentials (required) | object | - | - |
credentials.user (required) | string | - | Username. |
credentials.password (required) | string | - | Password. |
API Key
| Field | Type | Default | Notes |
|---|---|---|---|
type (required) | api_key | - | - |
credentials (required) | object | - | - |
credentials.key (required) | string | - | API key value sent as the 'X-API-Key' header. |
No auth
| Field | Type | Default | Notes |
|---|---|---|---|
type (required) | none | - | - |
Asset options
assets[].options:
| Field | Type | Default | Notes |
|---|---|---|---|
headers | array | - | HTTP headers to include in the request. Key-value pairs where both keys and values are strings. |
params | array | - | Array of query parameters. Each parameter has a name and value (string, number, or boolean). |
body | string | - | Request body content as a string. |
response_path | string | - | JSONPath expression to extract specific data from the API response. Maps to responsePath. |
cursor_path | string | - | JSONPath expression to extract the cursor token from the API response for cursor-based pagination. |
max_fetch_size | integer | - | Maximum number of rows kept in the final DataFrame after the asset is read (Spark limit). Independent of pagination.limit.max_records, which caps how many records pagination accumulates (and trims to) while paging. |
ignore_not_found | array of object | - | List of error rules to treat as 'no record' instead of failing the run. A response is skipped if it matches ANY rule in the list (OR). A rule matches on 'status_code' alone, or on 'status_code' AND 'status_message' (regex against the response body) when 'status_message' is present (AND). Example: [{status_code: 404}, {status_code: 500, status_message: 'NoCorrespondenceFound'}]. |
ignore_not_found[].status_code (required) | integer | - | HTTP status code to match. Range: 100 to 599. |
ignore_not_found[].status_message | string | - | Optional regular expression matched against the response body. When present, both 'status_code' and this must match (AND). |
pagination is one of:
Page number
| Field | Type | Default | Notes |
|---|---|---|---|
strategy (required) | page_number | - | Increments a page counter (e.g. pageIndex=1,2,3). |
param_location | query or body or header | query | Which part of the request carries the pagination parameters below. When 'body', parameter names are JSON Pointers and an empty options.body is treated as {}. |
page_num_param (required) | object | - | Parameter carrying the page number, incremented by one after each request. |
page_num_param.name (required) | string | - | Name of the query parameter or header (e.g. 'pageIndex'), or a JSON Pointer into the request body when 'param_location' is 'body' (e.g. '/paging/pageIndex'). |
page_num_param.start_value | integer | 1 | Page number sent on the first request. Set to 0 for APIs whose pages are zero-based. Minimum: 0. |
page_size_param (required) | object | - | Parameter carrying the records requested per page. Sent unchanged on every request. |
page_size_param.name (required) | string | - | Name of the query parameter or header (e.g. 'pageSize' or '$top'), or a JSON Pointer into the request body when 'param_location' is 'body' (e.g. '/paging/pageSize'). |
page_size_param.value (required) | integer | - | The page size, sent unchanged on every request. Has no default, since the right page size depends entirely on the endpoint. Minimum: 1. |
completion_on is one of:
Empty page
| Field | Type | Default | Notes |
|---|---|---|---|
mechanism | empty_page | - | Stop when a page has zero records. |
Short page
| Field | Type | Default | Notes |
|---|---|---|---|
mechanism | short_page | - | Stop when a page has fewer records than the page size. |
page_size_path (required) | string | - | JSONPath to the page size in the response (e.g. '$.pageSize'). |
Total pages
| Field | Type | Default | Notes |
|---|---|---|---|
mechanism | total_pages | - | Stop once the page count reported at total_pages_path has been read. |
total_pages_path (required) | string | - | JSONPath to the total page count in the response (e.g. '$.totalPages'). |
Total records
| Field | Type | Default | Notes |
|---|---|---|---|
mechanism | total_records | - | Stop once all records reported at total_records_path have been read. |
total_records_path (required) | string | - | JSONPath to the total record count in the response (e.g. '$.TotalCount'). |
Skip Records
| Field | Type | Default | Notes |
|---|---|---|---|
strategy (required) | skip_limit | - | Increments a record offset by the page size (e.g. $skip). |
param_location | query or body or header | query | Which part of the request carries the pagination parameters below. When 'body', parameter names are JSON Pointers and an empty options.body is treated as {}. |
skip_param (required) | object | - | Parameter carrying the number of records to skip, advanced by the page size after each request. |
skip_param.name (required) | string | - | Name of the query parameter or header (e.g. 'skip' or '$skip'), or a JSON Pointer into the request body when 'param_location' is 'body' (e.g. '/paging/skip'). |
skip_param.start_value | integer | 0 | Record offset sent on the first request. Advanced by the page size after each request. Minimum: 0. |
page_size_param (required) | object | - | Parameter carrying the records requested per page. Sent unchanged on every request and used to advance skip_param. |
page_size_param.name (required) | string | - | Name of the query parameter or header (e.g. 'pageSize' or '$top'), or a JSON Pointer into the request body when 'param_location' is 'body' (e.g. '/paging/pageSize'). |
page_size_param.value (required) | integer | - | The page size, sent unchanged on every request. Has no default, since the right page size depends entirely on the endpoint. Minimum: 1. |
completion_on is one of:
Empty page
| Field | Type | Default | Notes |
|---|---|---|---|
mechanism | empty_page | - | Stop when a page has zero records. |
Short page
| Field | Type | Default | Notes |
|---|---|---|---|
mechanism | short_page | - | Stop when a page has fewer records than the page size. |
page_size_path (required) | string | - | JSONPath to the page size in the response (e.g. '$.pageSize'). |
Total pages
| Field | Type | Default | Notes |
|---|---|---|---|
mechanism | total_pages | - | Stop once the page count reported at total_pages_path has been read. |
total_pages_path (required) | string | - | JSONPath to the total page count in the response (e.g. '$.totalPages'). |
Total records
| Field | Type | Default | Notes |
|---|---|---|---|
mechanism | total_records | - | Stop once all records reported at total_records_path have been read. |
total_records_path (required) | string | - | JSONPath to the total record count in the response (e.g. '$.TotalCount'). |
Cursor
| Field | Type | Default | Notes |
|---|---|---|---|
strategy (required) | cursor | - | Sends a continuation token read out of the previous response. |
param_location | query or body or header | query | Which part of the request carries the cursor parameter below. When 'body', the parameter name is a JSON Pointer and an empty options.body is treated as {}. |
cursor_param (required) | object | - | Parameter carrying the continuation token. Omitted from the first request unless start_value is set; on later requests the token from cursor_path is sent. |
cursor_param.name (required) | string | - | Name of the query parameter or header (e.g. 'cursor' or 'X-Continuation'), or a JSON Pointer into the request body when 'param_location' is 'body' (e.g. '/paging/token'). |
cursor_param.start_value | string | - | Optional token sent on the first request only. Omit for APIs that start cursor paging with no cursor param. |
cursor_path (required) | string | - | JSONPath expression locating the next-page token in the response body (e.g. '$.meta.next_cursor'). |
completion_on | object | - | How the loop detects it has read everything. |
completion_on.mechanism (required) | no_link or empty_page | no_link | no_link: stop when cursor_path resolves to null or is absent. empty_page: stop when a page has zero records (for APIs that keep returning a token past the last page). |
Next link
| Field | Type | Default | Notes |
|---|---|---|---|
strategy (required) | next_link | - | Follows an absolute next-page URL returned by the response (e.g. @odata.nextLink). |
next_link_path (required) | string | - | JSONPath expression locating an absolute next-page URL in the response body (e.g. "$['@odata.nextLink']"). The URL is requested as-is, carrying its own query string. |
completion_on | object | - | How the loop detects it has read everything. |
completion_on.mechanism (required) | no_link or empty_page | no_link | no_link: stop when next_link_path resolves to null or is absent. empty_page: stop when a page has zero records. |
File format options
An asset's options depend on its format:
csv
Valid options for CSV output operations based on Spark CSV data source version 3.5.1
| Field | Type | Default | Notes |
|---|---|---|---|
delimiter | string | - | Sets the single character used for separating fields. |
encoding | string | - | For reading, decodes the CSV files by the given encoding type. For writing, specifies encoding (charset) of saved CSV files. |
quote | string | - | Sets the single character used for escaping quoted values. |
escape | string | - | Sets the single character used for escaping quotes inside an already quoted value. |
comment | string | - | Sets the single character used for commenting out lines. |
header | boolean | true | Uses the first line as names of columns. Default: false. |
infer_schema | boolean | true | Infers the schema of the CSV file. Default: false. Maps to inferSchema. |
prefer_date | boolean | - | Indicates whether date should be preferred over timestamp. Maps to preferDate. |
enforce_schema | boolean | - | Indicates whether the schema should be enforced. Maps to enforceSchema. |
ignore_leading_white_space | boolean | - | Indicates whether leading whitespaces should be ignored. Maps to ignoreLeadingWhiteSpace. |
ignore_trailing_white_space | boolean | - | Indicates whether trailing whitespaces should be ignored. Maps to ignoreTrailingWhiteSpace. |
null_value | string | - | Sets the string representation of a null value. Maps to nullValue. |
nan_value | string | - | Sets the string representation of a NaN value. Maps to nanValue. |
positive_infinity | string | - | Sets the string representation of a positive infinity value. Maps to positiveInf. |
negative_infinity | string | - | Sets the string representation of a negative infinity value. Maps to negativeInf. |
date_format | string | - | Sets the string that indicates a date format. Maps to dateFormat. |
timestamp_format | string | - | Sets the string that indicates a timestamp format. Maps to timestampFormat. |
timestamp_without_timezone_format | string | - | Sets the string that indicates a timestamp without time zone format. Maps to timestampNTZFormat. |
enable_date_time_parsing_fallback | boolean | - | Indicates whether to enable date time parsing fallback. Maps to enableDateTimeParsingFallback. |
max_columns | integer | - | Sets the maximum number of columns to read. Maps to maxColumns. |
max_chars_per_column | integer | - | Sets the maximum number of characters to read for each column. Maps to maxCharsPerColumn. |
mode | PERMISSIVE or DROPMALFORMED or FAILFAST | - | Sets the mode to use for parsing the CSV file. Default: PERMISSIVE. |
column_name_of_corrupt_record | string | - | Sets the name of the column to store the corrupt record. Maps to columnNameOfCorruptRecord. |
multi_line | boolean | - | Indicates whether to enable multi line mode. Maps to multiLine. |
char_to_escape_quote_escaping | string | - | Sets the character to escape quote escaping. Maps to charToEscapeQuoteEscaping. |
sampling_ratio | number | - | Defines fraction of rows used for schema inferring. Maps to samplingRatio. |
empty_value | string | - | Sets the string representation of an empty value. Maps to emptyValue. |
locale | string | - | Sets the locale to use for parsing dates and timestamps. |
line_separator | string | - | Defines the line separator that should be used for writing. Maps to lineSep. |
unescaped_quote_handling | STOP_AT_CLOSING_QUOTE or BACK_TO_DELIMITER or STOP_AT_DELIMITER or SKIP_VALUE or RAISE_ERROR | - | Compression codec to use when saving to file. Default: STOP_AT_DELIMITER. Maps to unescapedQuoteHandling. |
excel
Valid options for reading Excel files via crealytics spark-excel
| Field | Type | Default | Notes |
|---|---|---|---|
header | boolean | true | Use the first row as names of columns. |
infer_schema | boolean | true | Infers the schema of the Excel sheet. Maps to inferSchema. |
sheet_name | string | - | Name of the sheet to read (e.g. 'Sheet1'). If not set, the first sheet is read. Maps to sheetName. |
data_address | string | - | Cell range to read in Excel format (e.g. "'My Sheet'!A1dataAddress. |
treat_empty_values_as_nulls | boolean | true | Whether to treat empty cells as null. Maps to treatEmptyValuesAsNulls. |
use_plain_number_format | boolean | false | When true, format cells without rounding and scientific notation. Maps to usePlainNumberFormat. |
set_error_cells_to_fallback_values | boolean | false | When true, ERROR cell values (e.g. #N/A) are converted to zero values of the column's data type. Maps to setErrorCellsToFallbackValues. |
date_format | string | - | Sets the string that indicates a date format. Maps to dateFormat. |
timestamp_format | string | - | Sets the string that indicates a timestamp format. Maps to timestampFormat. |
excerpt_size | integer | - | Number of rows to use for schema inference. Maps to excerptSize. |
add_color_columns | boolean | - | When true, adds color columns to the DataFrame. Default: false. Maps to addColorColumns. |
max_rows_in_memory | integer | - | Maximum number of rows to read into memory. When set, it uses a streaming reader which can help with big files. xls format files are not supported. Maps to maxRowsInMemory. |
max_byte_array_size | integer | - | Maximum byte array size to read into memory. Maps to maxByteArraySize. |
temp_file_threshold | integer | - | Number of bytes at which a zip entry is regarded as too large for holding in memory and the data is put in a temp file instead. Maps to tempFileThreshold. |
workbook_password | string | - | Password to access the workbook. Maps to workbookPassword. |
json
Valid options for JSON asset operations based on Spark JSON data source version 3.5.1
| Field | Type | Default | Notes |
|---|---|---|---|
allow_backslash_escaping_any_character | boolean | - | Allows accepting quoting of all characters using backslash quoting mechanism. Maps to allowBackslashEscapingAnyCharacter. |
allow_comments | boolean | - | Allows Java/C++ style comments in JSON. Maps to allowComments. |
allow_non_numeric_numbers | boolean | - | Allows JSON parser to recognize set of "Not-a-Number" (NaN) tokens as legal floating number values. Maps to allowNonNumericNumbers. |
allow_numeric_leading_zeros | boolean | - | Allows (non-standard) JSON integers to start with additional zero(s). Maps to allowNumericLeadingZeros. |
allow_single_quotes | boolean | - | Allows single quotes in addition to number quotes. Maps to allowSingleQuotes. |
allow_unquoted_control_chars | boolean | - | Allows JSON Strings to contain unquoted control characters. Maps to allowUnquotedControlChars. |
allow_unquoted_field_names | boolean | - | Allows unquoted field names in JSON. Maps to allowUnquotedFieldNames. |
column_name_of_corrupt_record | string | - | Sets the name of the column to store the corrupt record. Maps to columnNameOfCorruptRecord. |
date_format | string | - | Sets the string that indicates a date format. Default is "yyyy-MM-dd". Maps to dateFormat. |
drop_field_if_all_null | boolean | - | Whether to ignore column of all null values or empty array/struct during schema inference. Maps to dropFieldIfAllNull. |
enable_date_time_parsing_fallback | boolean | - | Indicates whether to enable date time parsing fallback. Maps to enableDateTimeParsingFallback. |
encoding | string | - | For reading, decodes the JSON files by the given encoding type. |
line_separator | string | - | Defines the line separator for parsing JSON files. Maps to lineSep. |
locale | string | - | Sets the locale to use for parsing dates and timestamps. |
mode | PERMISSIVE or DROPMALFORMED or FAILFAST | - | Sets the mode to use for parsing the JSON file. Default: PERMISSIVE. |
multi_line | boolean | - | Parse one record, which may span multiple lines, per file. Maps to multiLine. |
prefers_decimal | boolean | - | Infers all floating-point values as a decimal type. Maps to prefersDecimal. |
primitives_as_string | boolean | - | Infers all primitive values as a string type. Maps to primitivesAsString. |
sampling_ratio | number | - | Defines fraction of rows used for schema inferring. Maps to samplingRatio. |
timestamp_format | string | - | Sets the string that indicates a timestamp format. Default is "yyyy-MM-dd'T'HH:mmtimestampFormat. |
timestamp_without_timezone_format | string | - | Sets the string that indicates a timestamp without time zone format. Default is "yyyy-MM-dd'T'HH:mmtimestampNTZFormat. |
time_zone | string | - | Sets the string that indicates a time zone ID to be used to format timestamps. Maps to timeZone. |
orc
Valid options for ORC asset operations based on Spark ORC data source version 3.5.1
| Field | Type | Default | Notes |
|---|---|---|---|
merge_schema | boolean | - | Sets whether we should merge schemas collected from all ORC part-files. This will override spark.sql.orc.mergeSchema. Default: false. Maps to mergeSchema. |
parquet
Valid options for Parquet asset operations based on Spark Parquet data source version 3.5.1
| Field | Type | Default | Notes |
|---|---|---|---|
merge_schema | boolean | - | When true, merges schemas collected from all Parquet part-files. This will override spark.sql.parquet.mergeSchema. Maps to mergeSchema. |
datetime_rebase_mode | EXCEPTION or CORRECTED or LEGACY | - | The rebasing mode for the values of the DATE, TIMESTAMP_MILLIS, TIMESTAMP_MICROS logical types from the Julian to Proleptic Gregorian calendar. This will override spark.sql.parquet.datetimeRebaseModeInRead. Maps to datetimeRebaseMode. |
int96_rebase_mode | EXCEPTION or CORRECTED or LEGACY | - | The rebasing mode for the values of the INT96 timestamp type from the Julian to Proleptic Gregorian calendar. This will override spark.sql.parquet.int96RebaseModeInRead. Maps to int96RebaseMode. |
text
Valid options for Text asset operations based on Spark Text data source version 3.5.1
| Field | Type | Default | Notes |
|---|---|---|---|
whole_text | boolean | - | If true, read each file from input path(s) as a single row. Maps to wholetext. |
line_separator | string | - | Defines the line separator that should be used for reading. Default handles all \r, \r\n and \n. Maps to lineSep. |