Skip to main content

Configuration reference

Use this page to look up a field's type, effective default and runtime role. For a complete starting file and loading/path rules, see the configuration overview. Detailed pages explain the decisions behind each section.

The canonical schema is apibackuper/schemas/config_schema.json. Required sections are settings, project, params, data and storage. Each must be an object; data: {} is valid for a root array/object. Unknown keys are rejected in normal top-level sections. Follow rule objects have more permissive schema validation, so passing validation there does not prove execution support.

Reading the defaults​

Defaults below are the loader's effective fallbacks, not values inserted into your file. Omitted optional values differ from explicit YAML null: most string and numeric fields do not accept null. Use YAML numbers/booleans for typed fields, and quote string values such as credentials and dates.

${VAR} expansion happens before validation and produces strings. It is useful for secrets; a numeric field such as page_size_limit: "${PAGE_SIZE}" still becomes a string and does not satisfy an integer schema. JSON request files do not expand these placeholders. ${VAR:-default} handles unset/empty variables; there is no automatic .env loading.

Validate the complete file with:

apibackuper validate-config --strict -p /srv/catalog
apibackuper run full --dry-run -p /srv/catalog

Both are offline checks. The API's credentials, actual response keys, page-size cap and server-side filter semantics still need verification against the service.

settings​

FieldType / defaultRequirement and behavior
namestring; no defaultRequired project name
initializedboolean; omittedLegacy scaffold metadata; not a substitute for complete config
idstring; omittedDescriptive metadata identifier
splitterstring; .Nested response/record path separator; not JSONPath
logfilestring; apibackuper.logRelative to working directory unless absolute
state_filestring; project's apibackuper_state.jsonSuccessful-run state/watermark; explicit override is used as written
checkpoint_filestring; project's apibackuper_checkpoint.jsonResume progress; explicit override is used as written
checkpoint_interval_pagesinteger ≥ 0; 1Periodic saves every N pages; 0 leaves lifecycle saves enabled

Do not share recovery files between projects. Keep config and data files consistent with their checkpoint during resume. See project and data.

project​

FieldType / defaultRequirement and behavior
urlHTTP(S) URI stringRequired list/search endpoint
http_modeGET or POSTRequired; POST is JSON, not form data
descriptionstring; omittedDataset purpose/source description
work_modesstring; omittedLegacy declaration such as full,incremental,update; does not enforce an allowlist
iterate_bypage, skip, range, cursor, next_url, link_header; pageMain backup pagination; cursor modes are sequential
resp_typejson, xml, html; jsonMain response decoding; HTML requires extraction code
detectboolean; falseInfer selected keys from the first JSON response
update_modeby_change_key, by_timestamp, custom_scriptConditional fallback described below; custom script is reserved/rejected
default_delaynumber ≥ 0; 0.5Seconds slept after successful requests
retry_delayinteger ≥ 0; 5Fallback retry delay in seconds
retry_countinteger ≥ 0; 5Fallback retries after the initial attempt
force_retryboolean; falseLegacy accepted field; configure active policy under request.retry

If update_mode is omitted, a configured data.change_key selects change-key mode; otherwise timestamp mode is selected. The matching request parameter and a successful saved watermark are needed to send a selective filter. Work-mode metadata alone does not make an endpoint incremental.

params​

FieldType / defaultRequirement and behavior
page_size_limitinteger ≥ 1Required expected records per full page
start_pageinteger ≥ 1; 1Internal start page; sent unchanged in page mode
page_number_paramstring; omittedPage-mode request parameter; e.g. page or paging.page
page_size_paramstring; omittedRequest parameter receiving page size
cursor_paramstring; omittedCursor-mode request parameter receiving the token from the previous response
allow_cross_host_nextboolean; falseFollow next-page URLs on another host
count_skip_paramstring; omittedSkip-mode offset (page-1)*size
count_from_paramstring; omittedRange lower bound (page-1)*size
count_to_paramstring; omittedRange upper bound page*size; no automatic inclusive adjustment
query_modequery, params, mixed; queryPut changing values in query/body, semicolon URL params, or URL query respectively
force_flat_paramsboolean; falseLegacy GET top-level value serialization in default query mode
change_key_paramstring; omittedAPI request field receiving the previous successful change key
update_since_paramstring; omittedAPI request field receiving the successful timestamp watermark

This section holds parameter names. Fixed request values belong in params.json; changing values overwrite matching fields during page construction. Request-body nested fields use dot notation. See pagination and HTTP request files.

data​

FieldType / defaultInterpretation
data_keystring; omittedPath from response root to records; omit for root list/object
total_number_keystring; omittedPath from response root to total record count
pages_number_keystring; omittedPath from response root to total page count; fallback after record total
next_cursor_keystring; omittedcursor mode: path to the next token; missing or empty ends collection
next_url_keystring; omittednext_url mode: path or literal key of the next URL; missing ends collection
item_keystring; omittedIdentifier metadata; does not build an index or deduplicate archives
change_keystring; omittedPath from each extracted record to a comparable change value

settings.splitter separates these paths. A configured data_key must exist. Follow requires its own follow_item_key; comma-separated item_key metadata does not construct a composite follow identifier. Counts bound collection, while short/empty pages can end it earlier. See extraction and updates.

storage​

FieldType / defaultInterpretation
storage_typezip, filesystem, sqliteRequired main backend
storage_pathstring; storageDirectory for ZIP/filesystem; database filename for SQLite
compressionboolean; optionalAccepted; CLI ZIP always uses Deflate
compression_levelinteger 0–9; optionalReserved, not applied to CLI writes
max_file_sizeinteger ≥ 0; optionalReserved bytes value; no splitting/size cap
split_filesboolean; optionalReserved; no automatic archive splitting
capture.metadataboolean; trueWrite exchange_N.json provenance beside each page
capture.raw_bodyauto, always, never; autoWrite the original body as raw_N.<ext>; auto only for non-JSON responses

Relative paths resolve from the project. Full backups stage at a sibling .partial path; ZIP can also have a .journal directory. Changing the backend setting does not convert old data. See storage and recovery.

auth​

FieldType / defaultInterpretation
typebasic, bearer, apikey, oauth2Required when configuring usable authentication; omit the whole section for a public API
usernamestring; omittedBasic auth username
passwordstring; omittedBasic secret; precedes password_file
password_filestring; omittedFile containing only the password, whitespace stripped
tokenstring; omittedAccess token without Bearer prefix; precedes token_file
token_filestring; omittedBearer/OAuth2 access-token file, whitespace stripped
api_keystring; omittedHeader API key; no dedicated API-key-file field
api_key_headerstring; X-API-KeyHeader name for apikey
auth_urlURI string; omittedOAuth2 form-POST refresh endpoint
refresh_tokenstring; omittedOAuth refresh token; no dedicated refresh-token-file field

Credential-file paths are relative to the working directory. Files are read at load time. OAuth refresh is 401-triggered and updates tokens in memory only. See authentication for required combinations and provider limits.

rate_limit​

FieldType / defaultInterpretation
enabledboolean; true with sectionfalse disables the configured limiter
requests_per_secondpositive number; omittedToken refill rate; fractional rates allowed
requests_per_minuteinteger ≥ 0; omittedRolling minute cap; 0 means no minute cap
requests_per_hourinteger ≥ 0; omittedRolling hour cap; 0 means no hour cap
burst_sizeinteger ≥ 1; 5Initial/capacity tokens for the per-second bucket

No section, or no active quota, means no effective rate cap. Quotas apply in one process rather than across all account consumers.

request​

FieldType / defaultInterpretation
timeoutinteger ≥ 1; 120Legacy value; does not replace active connect/read pair
connect_timeoutinteger ≥ 1; 30Connection timeout seconds
read_timeoutinteger ≥ 1; 120Read inactivity timeout seconds, not whole-job duration
verify_sslboolean; trueNo CA-bundle path in this field
user_agentstring; apibackuper/<version>Session User-Agent
max_redirectsinteger ≥ 0; 5Maximum followed redirects
allow_redirectsboolean; trueAllow redirect handling
parallelisminteger ≥ 1; 1Concurrent main backup page workers
proxiesstring or schema-accepted objectUse implemented http=URL,https=URL string form; ordinary YAML mapping is not applied correctly
retry.max_retriesinteger ≥ 0; project.retry_countRetries after the initial attempt
retry.backoff_strategyfixed or exponential; fixedRetry delay calculation
retry.initial_delayinteger ≥ 0; project.retry_delayDelay base in seconds
retry.max_delayinteger ≥ 0; max(retry_delay,retry_delay*4)Cap on configured backoff, not server Retry-After
retry.retry_on_statusinteger array, HTTP 100–599Explicit retry statuses; fallback described below
retry.wait_headersstring array; [Retry-After]Headers read in order for the server-requested wait (seconds, HTTP date or Unix time)
retry.max_waitnumber ≥ 0; omittedFail instead of waiting longer than this many seconds
response_rulesarray of rules; omittedOrdered status/body_key/body_value/content_type conditions with retry, fail, missing or accept

Flat compatibility keys retry_max_retries, retry_backoff_strategy, retry_initial_delay, retry_max_delay, retry_on_status override the corresponding nested values. Flat status values also accept comma-separated strings. Missing retry status configuration falls back to error_handling.retry_on_errors, then [429,500,502,503,504]. An empty nested status list can still use the fallback; set max_retries: 0 to disable ordinary retries. OAuth refresh is a separate 401-handling step.

See request policy for delay examples, proxy syntax, quota scope and total request budgets.

error_handling and logging​

FieldType / defaultInterpretation
error_handling.retry_on_errorsInteger array or comma-separated string; [429,500,502,503,504]Fallback retry statuses
error_handling.max_consecutive_errorsinteger ≥ 0; 10Stop after this many consecutive unresolved page failures; 0 stops on the first failure, not unlimited
error_handling.continue_on_errorboolean; trueTry later pages after failure; incomplete runs still exit unsuccessfully
logging.levelDEBUG, INFO, WARNING, ERRORDEBUG without section, INFO for empty logging section

--verbose enables DEBUG file/console output after project initialization, overriding the configured threshold on commands that support that flag. The log path comes from settings.logfile and resolves from the working directory.

follow, files, hooks and code​

follow​

follow accepts a single rule object, an object with rules: [...], or a list of independent rules. Rule values override corresponding top-level defaults.

FieldType / defaultInterpretation
follow_modestringExecutable values: item, url, prefix; schema also accepts unimplemented drilldown
follow_http_modeGET or POST; GETDetail request method
follow_item_keystringRequired scalar ID path in every main record
follow_patternstringURL format for item mode, literal prefix for prefix mode
follow_paramstring; omittedID alias for formatting and additional request parameter
follow_url_keystringComplete URL path in the record for URL mode
follow_data_keystring; omittedDetail record wrapper path for pagination/export
rules[].namestring; omittedArchive suffix, e.g. details_events.zip
rules[].iterate_bystring; omittedUse page for implemented detail page-number pagination
rules[].params.page_number_paramstringRequired to activate rule page iteration
rules[].params.page_size_paramstring; omittedParameter receiving rule page size
rules[].params.page_size_limitinteger; main page sizeExpected rule full-page record count
rules[].params.max_pagespositive integer; 1000Per-ID safety bound; reaching it before a short page fails

follow_params.json supplies fixed detail-request values. Rules read the main records independently; they do not chain their output. Only unnamed details.zip is selected automatically by normal export/getfiles. See follow for source/output rules and continuation.

files​

FieldType / defaultInterpretation
fetch_modeprefix or patternRequired URL construction mode
root_urlstringRequired prefix/pattern; empty string preserves complete URLs
keysstringRequired comma-separated record paths, without spaces around commas
default_extstring; omittedExtension for ID-mode saved filenames
storage_modefilepath or id; filepathURL-path name or extracted-value name
file_storage_typezip or filesystem; zipDownloaded-byte output; main source must still be ZIP
use_aria2boolean or compatibility string; falseQueue transfers through fixed local aria2 RPC endpoint
max_file_sizeinteger ≥ 1; omittedSkip downloads larger than this many bytes

The discovery cache is reused until removed; existing output filenames are skipped. default_ext does not convert content and filepath does not include host/query in the name. See files for collision handling, source selection and aria2 policy.

hooks and code​

FieldTypeContract
hooks.before_runscript pathBase headers/params overrides
hooks.before_requestscript pathPer-page URL/headers/params overrides
hooks.after_responsescript pathObserve successful fetch snapshot
hooks.after_pagescript pathObserve cumulative record count and current page bytes
hooks.after_runscript pathObserve successful collection/publication summary
code.postfetchscript pathIn-process process(content) for HTML main responses
code.followscript pathIn-process process(content) for HTML detail responses

Hook paths resolve from the project; use absolute legacy extraction paths for portable invocation. Lifecycle callbacks use a separate process and 30-second timeout, return JSON, and run for backup/update rather than every command. Extraction scripts have a different failure/timeout model. See the complete hook contract.

Supported configuration does not always mean active behavior​

Setting / combinationCurrent status
storage.compression_level, max_file_size, split_filesAccepted but reserved
project.update_mode: custom_scriptAccepted by schema, rejected by execution
follow_mode: drilldownAccepted by schema, rejected by execution
request.proxies as a YAML objectAccepted by schema; use string form for effective proxy setup
data.item_key / project.work_modesDescriptive settings, not deduplication/filter implementation
Main SQLite/filesystem plus getfilesUnsupported main source for file discovery
Several follow rulesIndependent requests; no automatic multi-hop traversal or export merge

These distinctions matter when copying a schema-valid template. Verify the selected command's behavior and a small sample export before a large job.