Token-Authenticated REST API Retrieval Toolkit
Overview
A small, dependency-light toolkit for talking to token-authenticated REST APIs. It manages authentication tokens in process environment variables (never written to disk), builds requests with configurable authentication and pagination strategies, and retrieves paginated data either one page at a time or in chunks combined into a single tibble. The design is API-agnostic: a single 'apifetch_api' profile describes an endpoint together with how it authenticates and paginates, so the same verbs work across different services.
Bug fixes
af_fetch_all()no longer loops forever withaf_paginate_none(): an API that cannot be paged is now fetched with a single request.af_fetch_all()now acceptschunk_size = Inf(previously failed with a "missing value" error), and truncates tototal_limitwhen an API returns more rows than requested.parse_queries()(and therefore thequeryargument ofaf_fetch()) appends to an endpoint that already has a query string instead of producing a second?; dropsNULLandNAvalues instead of sendinga=ora=NA; repeats a key for multi-valued parameters; and errors clearly on an unnamed list.- Integer-like arguments (
limit,offset,chunk_size, ...) now reject vectors,NULL,NA,-Infand values beyond the integer range with a clear message, instead of silently becomingNAor failing cryptically.
Show all changes in 0.2.0Hide the rest of the changes in 0.2.0
- Token names with accents are sanitized to plain ASCII on every platform (macOS previously produced names such as
Sa'ude). af_list_tokens()matches theserviceprefix literally rather than as a regular expression, and skips empty variables.
Improvements
af_store_token()gainsoverwrite = FALSE, to rotate an expired token.af_fetch()returns an empty tibble for responses without a body (e.g. HTTP 204), gives a token-specific hint on HTTP 401/403, and a clear error when the response is not JSON (e.g. an HTML login or captive-portal page).- Added mocked-HTTP tests for
af_fetch()andaf_fetch_all(). - Requires 'httr2' >= 1.0.0.
From NEWS.md in the release
Install
Health
- OK13 OK2026-09-08
- ERROR12 OK, 1 ERROR2026-09-07
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK6 OK2026-07-03
Documentation
- Help pages
- 11 (1 internal)includes a package overview page
- Examples that run
- 80%8 run in a plain check · 2 never run
- Exported functions with examples
- 100%
- Documented parameters
- 93%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
Releases over time
Commits over time
9 development-tooling and community-health practices detected across 4 families in the upstream repository
Checks run against github.com/strategicprojects/apifetch on 2026-10-22.
The R CMD check workflow runs on Linux, macOS and Windows
GitHub Pages site last deployed 2026-09-28 · The repository has a site deploy workflow
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-06-26Named in .Rbuildignore: CLAUDE.mdNamed in .gitignore: .claude, CLAUDE.mdCommits: at least 22 crediting it in the message
- Claude Opus 4.814 commits · Jun to Jul 2026
- Claude Opus 5.55 commits · Sep 2026
- Claude Fable 53 commits · Jul 2026
Dependencies
Installing apifetch adds 20 packages (13 with compiled code, 7.3 MB of source tarballs). Heaviest: openssl 1.1 MB, vctrs 1.0 MB, dplyr 902 KB.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- 0.2.0Latest
- 0.1.02026-07-02
- RR 4.6.0 released · 2026-04-24
Package metadata
- First published
- 2026-07-02
- Total releases
- 2 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.1.0
- Download size
- 48 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("apifetch")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-23, which the citation names so these numbers can be found later. More on citing and the projects behind them.