APS Harvesting API

General

Content Negotiation

Endpoints that support content negotiation use a content type specified using the Accept request header. See supported formats for a complete list of formats and the documentation for individual endpoints to see which formats are supported for each of them.

Example (request article in APS JSON format):

Accept: application/vnd.tesseract.article+json

Responses

Individual endpoints define the responses they provide. Clients should guard against general network and HTTP errors such as timeouts, unexpected server errors (50x responses), etc. Most supported error responses provide additional information about the error (see Error Responses).

Response Payloads

All JSON responses wrap the object(s) returned in an object containing the top-level key data. This is done to provide future-proofing of response objects. The actual data contained in the data key is specified by the type of response (see documentation for each endpoint below).

Example (list of objects returned):

{
  "data": [
  ]
}

Example (single object returned):

{
  "data": {
  }
}

Authentication

There are four main authentication types supported for access to the API:

  • No authentication - Open access (Creative Commons) articles may be retrieved without any requirement for authentication
  • API key - Access using a provided API key
  • IP authentication - Access from specific IP address ranges granted by APS to specific formats and sets of the content
  • CHORUS Agency Access via tokens - Access to content by funding agencies participating in CHORUS. Agencies provide their token via the CHOR-Agency-Auth-Token request header (see CHORUS Token).

Only one method is used per request. A CHOR-Agency-Auth-Token header takes precedence over an API key, and an API key takes precedence over IP authentication.

API Key

API key based authentication uses a key provided by APS included in the Authorization header:

Authorization: Bearer <token>

CHORUS Token

Funding agencies participating in CHORUS authenticate by sending the token issued to them by CHORUS in the CHOR-Agency-Auth-Token request header:

CHOR-Agency-Auth-Token: <token>

The token is validated with CHORUS on every request and identifies the funder, along with any other funders the agency acts as an agent for. A request made with a valid token has access to:

  • articles that list one of those funders in their funding information (the fundings field of the Article Response), and
  • open access (Creative Commons) articles, regardless of funder.

Requests for any other article return 401 Unauthorized. A token that is invalid or expired also returns 401 Unauthorized, with no response body; the request is not retried using an API key or IP authentication.

Article metadata is always available in the JSON format. Access to the PDF, XML and package formats depends on what has been enabled for the agency's account; requesting a format that is not enabled returns 401 Unauthorized.

Pagination

Endpoints that return a list of objects will paginate the response if the number of items exceeds a requested or internal limit. When additional results are available the Link header will be returned following the convention described in draft-nottingham-http-link-header-06 and popularized by the GitHub API. Always follow the Link header values; do not construct your own URLs.

Several libraries are available for parsing these headers:

Example:

Link: <https://harvest.aps.org/v2/journals/articles?from=2015-01-01&page=2&per_page=100>; rel="next", <https://harvest.aps.org/v2/journals/articles?from=2015-01-01&page=56&per_page=100>; rel="last"

Endpoints

GET /v2/journals/articles

Retrieve a list of articles given some criteria.

URL Parameters

Name Type Values Description
from Date or timestamp YYYY-MM-DD or YYYY-MM-DDThh:mm:ssZ Earliest date to return, inclusive. Optional: omit it to start from the earliest article available to you.
until Date or timestamp YYYY-MM-DD or YYYY-MM-DDThh:mm:ssZ Latest date to return, inclusive. Optional, but requires from.
date String modified, published Which date from and until apply to, and the order results are returned in: "modified" (default) or "published". See Dates.
journals String see journals Journal codes to restrict to (comma separated). Only the journals listed are returned.
set String see sets Set to restrict to, for example: "openaccess"
page Integer 1 or more Page of results to return (default 1). Follow the Link header rather than setting this yourself (see Pagination).
per_page Integer 1 to 100 Number of results to return per response (default and maximum 100; a value outside the range is treated as 100)

Dates

  • modified is the time the article's XML was last changed: when it was first published, and again whenever it is republished with changes, for example when it is corrected or retracted. It is returned as metadata_last_modified_at on each article.
  • published is the article's publication date. Only the date part of from and until is used.

Dates and timestamps follow ISO 8601. A date without a time covers the whole day in UTC: from=2015-01-01 starts at 00:00:00 UTC on January 1, and until=2015-01-31 ends at 23:59:59 UTC on January 31. For example, from=2015-01-01&until=2015-01-31 returns everything for January 2015.

Results are returned oldest first by the selected date. Articles sharing a date are returned in a fixed order, so pages do not overlap.

Request Headers

  • Accept - the content type to return. Only application/vnd.tesseract.article+json (default) is supported for this operation. The response is returned as application/json.
  • CHOR-Agency-Auth-Token - a CHORUS issued authentication token (see CHORUS Token). If specified, the returned items are restricted to articles funded by the funder(s) the token identifies, plus open access articles regardless of funder. When set=openaccess is also given, only open access articles are returned, whether or not they match the funder(s).

Responses

  • 200 OK - list of Article Response objects
  • 400 Bad Request - invalid or conflicting parameters specified (e.g., until is earlier than from, or until without from)
  • 401 Unauthorized - access to the requested resource(s) is not permitted: a journal or date range outside your entitlement, or an invalid or expired token if using CHORUS token access.
  • 403 Forbidden - the request could not be authenticated, or your account's API access period has not started or has ended

GET /v2/journals/articles/{id}

Retrieve a specific article by its ID (DOI). The article will be returned in the format requested.

URL Parameters

  • id - the ID of the article (DOI)

Request Headers

  • Accept - the content type for one of the supported formats.
  • CHOR-Agency-Auth-Token - a CHORUS issued authentication token (see CHORUS Token). If specified, the article is returned only if it is funded by the funder(s) the token identifies or is a Creative Commons article.

Responses

  • 200 OK - Article Response object
  • 400 Bad Request - invalid URL parameters specified
  • 401 Unauthorized - access to the requested article or format is not permitted: the article is outside your entitlement (including, for CHORUS token access, an article that is neither funded by your funder(s) nor Creative Commons), the requested format (PDF, XML or package) is not enabled for your account, or an invalid or expired token if using CHORUS token access.
  • 403 Forbidden - the request could not be authenticated, or your account's API access period has not started or has ended
  • 404 Not Found - the requested article could not be found
  • 406 Not Acceptable - an invalid media type was requested

Response Headers

  • Content-SHA1 - returned only for packaged responses that are small enough to be built in memory, contains the hex encoded SHA1 checksum of the payload. Large bags are streamed as they are assembled and are sent with Transfer-Encoding: chunked and no Content-SHA1, ETag, Content-Length or Accept-Ranges header.

GET /v2/journals/articles/{id}/accepted_fulltext

Retrieve a specific article's accepted full text PDF by its ID (DOI).

URL Parameters

  • id - the ID of the article (DOI)

Request Headers

  • X-API-Key - issued API key to authenticate/authorize the request

Responses

  • 200 OK - Accepted full text (PDF) of the article
  • 401 Unauthorized - access to the requested resource(s) is not permitted. This may be due to missing/invalid API key for access.
  • 403 Forbidden - the request could not be authenticated, or your account's API access period has not started or has ended
  • 404 Not Found - the requested article's accepted full text could not be found

Supported Formats

Content Type Description
application/vnd.tesseract.article+json APS article JSON (Default)
application/zip BagIt
application/pdf PDF
text/xml XML

APS Article JSON

The JSON format provides the article metadata in an easy-to-consume format. Full documentation for the fields within the returned JSON object can be found in the Article Response section. A JSON Schema is also provided to validate responses and provide additional documentation.

Packaging Formats

The BagIt format provides a mechanism for packaging deliverables consisting of multiple files. The Harvesting API provides a bag per article in zip format. When unpacked, the bag contains a directory named using the basename of the filename parameter in the Content-Disposition header. For example, a response with the following header:

Content-Disposition: attachment; filename="articlebag-10-1103-PhysRevX-5-021001-complete.zip"

unpacks to the following structure:

articlebag-10-1103-PhysRevX-5-021001-complete/
  |-- manifest-md5.txt
  |-- manifest-sha1.txt
  |-- bagit.txt
  |-- bag-info.txt
  +-- data/
        +-- PhysRevX.5.021001/
              |-- figure_f1.eps.gz
              |-- figure_f2.eps.gz
              |-- figure_f3.eps.gz
              |-- figure_f4.eps.gz
              |-- figure_f5.eps.gz
              |-- figure_f6.eps.gz
              |-- fulltext.ocr
              |-- fulltext.xml
              |-- metadata.xml
              |-- online.pdf
              |-- print.pdf
              |-- e063607_1.mp4
              +-- supplemental_files/
                    |-- readme.txt
                    +-- data_table.csv

The bag name is articlebag-, followed by the article DOI with every / and . replaced by -, followed by - and the bag format. The article's files live under data/ in a directory named after the DOI with the 10.1103/ prefix removed.

Available Package Formats

Each account with access to a package format is assigned one bag format. The format is reported in the bagit_urls field of the Article Response and determines which components are included in the bag.

Format Components
complete PDF (online, print, onecol), XML (metadata, fulltext), figures, OCR, video, supplemental files
pdfxml PDF (online), XML (metadata, fulltext)
apsxml XML (fulltext)
adsfulltext XML (fulltext), OCR
tdm PDF (online), XML (fulltext), OCR

File Types

A component is only included when the article has the corresponding file. The files a bag may contain are:

Component File Description
PDF online.pdf the online version of the article
PDF print.pdf the print version of the article
PDF onecol.pdf the single column version of the article
XML metadata.xml the article metadata, in JATS XML where available, otherwise APS XML
XML fulltext.xml the article full text, in JATS XML where available, otherwise APS XML
figure figure_f{n}.{ext} one file per figure, numbered as in the article, keeping the original file extension (for example figure_f1.eps.gz or figure_f2.jpeg)
OCR fulltext.ocr the OCR text of the article
video original filename one file per video, under its original filename (for example e063607_1.mp4); only files with a video/* content type are included
supplemental files supplemental_files/{filename} one file per supplementary (EPAPS) file, under its original filename, in a supplemental_files subdirectory

Actual names of the bags and contents will vary depending on what components the request is authorized to retrieve.

Validating a Bag

After downloading a bag, check that it arrived complete and undamaged:

  1. Unpack the zip. If it fails to unpack, the download was cut short; request the bag again.
  2. Check each file against the manifest-*.txt files contained in the bag. Each line of a manifest lists a file and its expected checksum. Always do this step.
  3. If the response included a Content-SHA1 header, also check that the SHA1 checksum of the zip file matches it. Large bags do not include this header, so rely on steps 1 and 2 for those.

The rest of this section explains why the header is sometimes absent.

Small bags are built in memory before they are sent, and the response carries a Content-SHA1 header with the hex encoded SHA1 checksum of the zip, along with ETag, Content-Length and Accept-Ranges. When Content-SHA1 is present, verify that the SHA1 checksum of the retrieved bag matches it.

Large bags (for example those with video) are streamed as they are assembled, so the checksum of the finished zip is not known when the response headers are sent. These responses use Transfer-Encoding: chunked and carry no Content-SHA1, ETag, Content-Length or Accept-Ranges header. If the connection is interrupted mid-bag the zip is truncated and will fail to unpack; rely on the manifests and on a successful unpack rather than on a Content-SHA1 header. Range requests are not supported for streamed bags.

Journals

Code Name
APSOS APS Open Science
PRA Physical Review A
PRAB Physical Review Accelerators and Beams
PRAPPLIED Physical Review Applied
PRB Physical Review B
PRC Physical Review C
PRD Physical Review D
PRE Physical Review E
PRFLUIDS Physical Review Fluids
PRL Physical Review Letters
PRMATERIALS Physical Review Materials
PRSTPER Physical Review Special Topics - Physics Education Research
PRRESEARCH Physical Review Research
PRX Physical Review X
PRXENERGY PRX Energy
PRXINTELLIGENCE PRX Intelligence
PRXLIFE PRX Life
PRXQUANTUM PRX Quantum
RMP Reviews of Modern Physics
PRSTAB Physical Review Special Topics - Accelerators and Beams
PRPER Physical Review Physics Education Research
PR Physical Review
PRI Physical Review (Series I)

Sets

Code Description
openaccess Open access

Response Objects

Article Response

Fields that may contain formatting, such as title and abstract, use HTML with embedded MathML, suitable for display with MathJax. All strings are UTF-8.

Example

{
  "id": "10.1103/PhysRevX.5.021001",
  "type": "article",
  "abstract": {
    "value": "<p>The first law of thermodynamics imposes not just a constraint on the energy content of systems in extreme quantum regimes but also symmetry constraints related to the thermodynamic processing of quantum coherence. We show that this thermodynamic symmetry decomposes any quantum state into mode operators that quantify the coherence present in the state. We then establish general upper and lower bounds for the evolution of quantum coherence under arbitrary thermal operations, valid for any temperature. We identify primitive coherence manipulations and show that the transfer of coherence between energy levels manifests irreversibility not captured by free energy. Moreover, the recently developed thermomajorization relations on block-diagonal quantum states are observed to be special cases of this symmetry analysis.</p>",
    "format": "html"
  },
  "articleType": "article",
  "authors": [
    {
      "type": "Person",
      "name": "Matteo Lostaglio",
      "firstname": "Matteo",
      "surname": "Lostaglio",
      "affiliationIds": [
        "a1"
      ]
    },
    {
      "type": "Person",
      "name": "Kamil Korzekwa",
      "firstname": "Kamil",
      "surname": "Korzekwa",
      "affiliationIds": [
        "a1"
      ]
    },
    {
      "type": "Person",
      "name": "David Jennings",
      "firstname": "David",
      "surname": "Jennings",
      "affiliationIds": [
        "a1"
      ]
    },
    {
      "type": "Person",
      "name": "Terry Rudolph",
      "firstname": "Terry",
      "surname": "Rudolph",
      "affiliationIds": [
        "a1"
      ]
    }
  ],
  "affiliations": [
    {
      "name": "Department of Physics, Imperial College London, London SW7 2AZ, United Kingdom",
      "id": "a1"
    }
  ],
  "date": "2015-04-01",
  "fundings": [
    {
      "funderId": "http://dx.doi.org/10.13039/501100000266",
      "funderName": "Engineering and Physical Sciences Research Council",
      "awards": []
    },
    {
      "funderId": "http://dx.doi.org/10.13039/501100000921",
      "funderName": "European Cooperation in Science and Technology",
      "awards": [
        "MP1209"
      ]
    },
    {
      "funderId": "http://dx.doi.org/10.13039/501100000288",
      "funderName": "Royal Society",
      "awards": []
    },
    {
      "funderId": "http://dx.doi.org/10.13039/501100000275",
      "funderName": "Leverhulme Trust",
      "awards": []
    }
  ],
  "metadata_last_modified_at": "2015-04-01T12:39:49-0400",
  "last_modified_at": "2015-04-01T12:39:49-0400",
  "identifiers": {
    "doi": "10.1103/PhysRevX.5.021001"
  },
  "issue": {
    "number": "2"
  },
  "pageStart": "021001",
  "hasArticleId": true,
  "numPages": 11,
  "publisher": {
    "name": "APS"
  },
  "rights": {
    "rightsStatement": "Published by the American Physical Society",
    "copyrightYear": 2015,
    "copyrightHolders": [
      {
        "name": "authors"
      }
    ],
    "creativeCommons": true,
    "licenses": [
      {
        "url": "http://creativecommons.org/licenses/by/3.0/"
      }
    ]
  },
  "journal": {
    "id": "PRX",
    "abbreviatedName": "Phys. Rev. X",
    "name": "Physical Review X"
  },
  "classificationSchemes": {
    "physh": {
      "concepts": [
        {
          "id": "...",
          "facet": { "id": "..." },
          "primary": true
        }
      ],
      "disciplines": [
        "..."
      ]
    }
  },
  "title": {
    "value": "Quantum Coherence, Time-Translation Symmetry, and Thermodynamics",
    "format": "html"
  },
  "volume": {
    "number": "5"
  }
}

Fields:

  • id (string) the identifier for the article. This is typically the DOI but should be treated as an opaque identifier used only within the context of this API. To obtain the DOI, see the identifiers field.
  • type (string) the type of object this is (always "article" in this API)
  • authors (array) the authors in the order they appear in the article
    • type (string) "Person" in the case of an individual person, "Collaboration" for collaborations
    • name (string) the full formatted name
    • firstname (string) the first (given) name(s)
    • surname (string) the surname
    • affiliationIds (array) an array containing the IDs of the affiliations the author is linked to
  • affiliations (array) the affiliations
    • id the internal document identifier for this affiliation (used to link authors with affiliations)
    • name the affiliation name
  • date (string) the date of publication in YYYY-MM-DD format
  • articleType (string)
  • identifiers (object)
    • doi the DOI for the article
    • arxiv the arXiv identifier, when the article has one
  • journal (object) the journal the article was published in
    • id (string) APS specific identifier for this journal
    • abbreviatedName (string) the abbreviated name of the journal (used when citing and in other contexts)
    • name (string) the full (unabbreviated) name of the journal
  • hasArticleId (boolean) whether or not this article uses article IDs rather than page numbers (in which case the page number must be treated as an opaque identifier)
  • issue (object)
    • number the issue "number", should be treated as a string since issues may not necessarily be purely numeric (e.g., "1-2")
  • volume (object)
    • number the volume number
  • pageStart (string) the starting page number for the article. If hasArticleId is true this must be treated as an opaque identifier
  • pageEnd (string) the ending page number for the article (only when hasArticleId is false)
  • seqnum (number) the sequence number of the article on its starting page, when more than one article starts on the same page
  • numPages (number) the number of pages as they appeared in the print or online PDF
  • metadata_last_modified_at (timestamp) the latest time the article's XML was changed (first publication, correction, retraction); date=modified filters and orders on this
  • last_modified_at (timestamp) the latest time any of the components of this article were modified
  • tocSection (object) table of contents section information
    • label (string) the label (title) of the table of contents the article appeared in
  • title (object) the title of the article
    • format (string) the format the value of the title is in (currently only "html" is supported)
    • value (string) the title in the specified format
  • abstract (object) the abstract of the article
    • format (string) the format the value of the title is in (currently only "html" is supported)
    • value (string) the abstract in the specified format
  • classificationSchemes (object) the classification schemes that have been applied to this article keyed by their type
    • physh (object) the PhySH classification of this article
      • concepts (array) the PhySH concepts applied
        • id (string) the concept identifier
        • facet (object) the facet the concept is applied under, with its id
        • primary (boolean) whether this is a primary concept for the article
      • disciplines (array) the PhySH discipline identifiers
  • fundings (array) the funding that applies to this article
    • funderId (string) the fundref ID of the funder
    • funderName (string) the name of the funder
    • awards (array) an array of award IDs (grants, etc.)
  • rights (object) the copyright and licensing rights for this article
    • rightsStatement
    • copyrightYear
    • copyrightHolders (array)
      • name (string)
    • creativeCommons (boolean) whether or not this article is licensed under a Creative Commons license (see licenses for the specific license)
    • licenses (array)
      • url (string)
      • licenseStatement (string) the license's usage statement, when there is one
  • notes (array) author notes on the contributors (for example, equal contribution or corresponding author), when there are any
    • id (string), label (string), type (string, always "contrib"), format (string, "html") and value (string)
  • bagit_urls (object) for accounts with access to a package format, the URL of the article's bag keyed by bag format

Error Responses

Most errors will return a JSON response with an error object containing a message with additional details.

Example:

{
  "errors": [
    {
      "title": "zip format not authorized"
    }
  ]
}

Examples - curl

The examples below use curl to demonstrate some common API use cases. The headers are shown along with abbreviated response payloads; full payloads have been omitted for brevity.

Retrieve all articles newer than January 1, 2015

curl -D - -H 'Accept: application/vnd.tesseract.article+json' 'https://harvest.aps.org/v2/journals/articles?from=2015-01-01'

Response:

HTTP/1.1 200 OK
Server: nginx/1.7.9
Date: Mon, 27 Apr 2015 12:57:17 GMT
Content-Type: application/json
Content-Length: 403667
Connection: close
Status: 200 OK
Link: <https://harvest.aps.org/v2/journals/articles?from=2015-01-01&page=2&per_page=100>; rel="next", <https://harvest.aps.org/v2/journals/articles?from=2015-01-01&page=56&per_page=100>; rel="last"

{"data":[...]}

Retrieve all articles using a CHORUS token

curl -D - -H 'CHOR-Agency-Auth-Token: <your-token>' 'https://harvest.aps.org/v2/journals/articles'

Replace <your-token> with the token issued to your agency. The response has the same form as the previous example, including articles matching the token's funder(s) as well as Creative Commons/open-access articles regardless of funder. Parameters such as from, until and journals may be combined with the token to narrow the results.

A single article is retrieved with the same header:

curl -D - -H 'CHOR-Agency-Auth-Token: <your-token>' -H 'Accept: application/vnd.tesseract.article+json' 'https://harvest.aps.org/v2/journals/articles/10.1103/PhysRevX.5.021001'

Retrieve a single article - JSON format

curl -D - -H 'Accept: application/vnd.tesseract.article+json' 'https://harvest.aps.org/v2/journals/articles/10.1103/PhysRevX.5.021001'

Response:

HTTP/1.1 200 OK
Server: nginx/1.7.9
Date: Mon, 27 Apr 2015 12:55:10 GMT
Content-Type: application/vnd.tesseract.article+json
Content-Length: 2842
Connection: close
Status: 200 OK

{"data":{...}}

Retrieve a single article - PDF format

curl -D - -H 'Accept: application/pdf' 'https://harvest.aps.org/v2/journals/articles/10.1103/PhysRevX.5.021001'

Response:

HTTP/1.1 200 OK
Server: nginx/1.7.9
Date: Wed, 29 Apr 2015 20:15:57 GMT
Content-Type: application/pdf
Content-Length: 749834
Connection: close
Vary: Accept-Encoding
Status: 200 OK
ETag: "4d1c9cab10e2030a9ce751017081f73e34f35c0f"
Content-Disposition: inline; filename=PhysRevX.5.021001.pdf

...

Retrieve a single article - Package format

curl -D - -H 'Accept: application/zip' 'https://harvest.aps.org/v2/journals/articles/10.1103/PhysRevX.5.021001'

Response:

HTTP/1.1 200 OK
Server: nginx/1.7.9
Date: Wed, 29 Apr 2015 20:43:35 GMT
Content-Type: application/zip
Content-Length: 1833565
Connection: close
Status: 200 OK
ETag: "85797c188ca0fbcb1bf73b55e4d1bd98d9c4c4bc"
Cache-Control: max-age=86400
Expires: Thu, 30 Apr 2015 20:43:35 GMT
Content-SHA1: 85797c188ca0fbcb1bf73b55e4d1bd98d9c4c4bc
Accept-Ranges: bytes
Content-Disposition: attachment; filename="articlebag-10-1103-PhysRevX-5-021001-complete.zip"

...

A large bag is streamed instead, and the response has no Content-Length, ETag, Content-SHA1 or Accept-Ranges header:

HTTP/1.1 200 OK
Content-Type: application/zip
Transfer-Encoding: chunked
Cache-Control: max-age=86400
Expires: Thu, 30 Apr 2015 20:43:35 GMT
Content-Disposition: attachment; filename="articlebag-10-1103-PhysRevX-5-021001-complete.zip"

...

Retrieve all open access articles

Open access articles (typically Creative Commons CC-BY) may be retrieved without the need for any authentication. The set parameter must be provided and set to "openaccess".

curl 'https://harvest.aps.org/v2/journals/articles?set=openaccess'

The full text XML and PDF of the article may be retrieved by calling the endpoint for individual articles using the DOI retrieved in the list response and setting the appropriate Accept header:

Full text XML:

curl -H 'Accept: text/xml' 'https://harvest.aps.org/v2/journals/articles/10.1103/PhysRevSTAB.4.072801'

PDF:

curl -H 'Accept: application/pdf' 'https://harvest.aps.org/v2/journals/articles/10.1103/PhysRevSTAB.4.072801'