OSF Preprints upstream quirks
The facts below describe the live API at https://api.osf.io/v2/. They
shape choices in this client, and the upstream documentation does not
always state them.
Paging
- List routes paginate with a numeric
pageparameter and honorpage[size]. The cap is 100 records per page on every route except the provider list, which defaults to and acceptspage[size]up to 1000. Larger values are silently clamped, and the answer reports the clamped value aslinks.meta.per_page. - The pagination total is not
meta.total; it lives underlinks.meta.total. The client's unwrapper reads it there. - There is no cursor paging.
links.nextcarries the next page number. links.firstisnullon page 1 and points at the route root from page 2 on.- List windows are not stable while records arrive. During one run, four consecutive pages of 100 newest-first records held 366 unique records, because new submissions shifted the window between requests. The client reports what each page served; no duplicates appeared in that run.
- Every entity path needs its trailing slash. The slash-less path answers a 301 redirect, and the client does not follow redirects, so all paths in this client keep the slash.
Sorting and searching
sortacceptsdate_created,date_modified, anddate_published, each also with a-prefix for descending order. Any other value is silently ignored and the answer comes back in the default order (newest first), so the client rejects unknown sorts withConfigurationErrorbefore sending.- The list routes have no free-text search: a
qparameter is silently ignored. Narrow results with filters instead.
Filters
- Unknown filter names answer 400 with
"Value '<name>' is not a filterable field."(or"'<name>' is not a valid field for this endpoint."on some routes), soPreprintFiltersandProviderFilterscarry only filters the API accepted. - Boolean filters are honored:
filter[is_published]=falseanswers a total of 0, while every record in the corpus is published. - Date filters accept comparison sub-keys:
filter[date_created][gte]=2025-01-01, and likewise[gt],[lte], and[lt]. An unparseable date value is silently ignored. filter[provider]matches the provider id (osf,psyarxiv).- Not filterable despite the attributes existing:
doi,is_latest_version,date_withdrawn,has_coi,has_data_links,has_prereg_links. - On the provider list route,
filter[name]matches the exact name;osfdoes not matchOpen Science Framework.
Records
original_publication_dateis a date on some records and a full datetime (2025-09-15T04:00:00) on others; the model accepts both.- The
osfprovider servesadditional_providersas an empty list where other providers serve a boolean, and one provider servesfacebook_app_idas an integer; the model accepts both shapes. footer_linksis an empty string when a provider has no footer links and a list of link objects otherwise.required_fieldson a license record is a list of plain field-name strings on some providers (year,copyrightHolders) and an empty list on others.- The documented route
GET /providers/preprints/{id}/serves a shorter attribute set than the legacy aliasGET /preprint_providers/{id}/, which addsbanner_path,email_contact,header_text,logo_path,social_facebook,social_instagram,social_twitter, andsubjects_acceptable. This client calls the documented route; the extra attributes stayNonethere. GET /preprints/{id}/files/lists storage root folders, not files. The primary file record appears underGET /preprints/{id}/files/osfstorage/with its size and hashes.GET /preprints/{id}/identifiers/stays empty until the preprint's DOI is registered; thedoiattribute of the preprint carries the DOI either way.- The citation detail route keeps its citation type (for example
webpage) in the sametypekey the JSON:API envelope uses for its own resource type, so the model moves the attribute tocitation_type. GET /preprints/{id}/versions/serves full preprint records, one per version, with suffixed ids (muryv_v1,muryv_v2).
Embedding
embed=providerworks on the preprint list routes and adds anembedsobject to each record.embed=primary_fileon the list route answers HTTP 502 consistently; treat primary file access asprimary_file_idpluspreprints.storage_files()instead.
Errors
- A missing record answers 404 with
{"errors": [{"detail": "Not found."}]}, which raisesNotFoundError. - Routes that need a personal token (review actions, moderators,
subscriptions, withdrawal requests) answer 401 with
"Authentication credentials were not provided."without one. - Transient 502 answers occur; the client retries them per its settings.