inspirehep.net

inspirehep.net

Science

High Energy Physics info. system. Inspire exposes an API (Application Programming Interface) for querying most aspects of its holdings and provides responses in either XML, Enhanced MARCXML or JSON.

Visit API

📚 Documentation & Examples

Everything you need to integrate with inspirehep.net

🚀 Quick Start Examples

inspirehep.net Javascript Examplejavascript
// inspirehep.net API Example
const response = await fetch('https://inspirehep.net/info/hep/api?ln=en', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

Getting started with Inspire API

Inspirehep.net provides API services to access their scientific publications and author's data. In this tutorial, we'll learn how to use the Inspire API to fetch publications, authors, and a list of fields that we can query for.

Before we get started exploring the Inspire API, we need to create a free account. We'll get an API key after signing up. We'll be using this API key to authenticate each request we make to the Inspire API.

Authorizing the Inspire API

We'll use the Authorization header to authenticate each request. The format of the Authorization header is:

Authorization: Bearer <access_token>

Where <access_token> is the API key generated when we signed up for the Inspire API.

We need to make sure that our API key is not public and is only visible to us.

Fetching Publications

To fetch publications, make a GET request to the following endpoint:

https://inspirehep.net/api/literature?q=<query>[&p=<page>]

Where <query> is the search query and <page> is the page number of the results (optional).

Here is some sample JavaScript code that demonstrates how to make a request to the Inspire API to fetch publications:

const apiKey = "<insert api key here>";
const query = "find publications authored by John Doe";
const endpoint = `https://inspirehep.net/api/literature?q=${query}`;

fetch(endpoint, { headers: { Authorization: `Bearer ${apiKey}` } })
  .then((response) => response.json())
  .then((data) => console.log(data));

Fetching Authors

To fetch authors, make a GET request to the following endpoint:

https://inspirehep.net/api/authors?q=<query>[&p=<page>]

Where <query> is the search query and <page> is the page number of the results (optional).

Here is some sample JavaScript code that demonstrates how to make a request to the Inspire API to fetch authors:

const apiKey = "<insert api key here>";
const query = "find authors with the family name Doe";
const endpoint = `https://inspirehep.net/api/authors?q=${query}`;

fetch(endpoint, { headers: { Authorization: `Bearer ${apiKey}` } })
  .then((response) => response.json())
  .then((data) => console.log(data));

Fetching Fields

To fetch the list of fields we can query for, make a GET request to the following endpoint:

https://inspirehep.net/api/literature/fields

Here is some sample JavaScript code that demonstrates how to make a request to the Inspire API to fetch the list of fields:

const apiKey = "<insert api key here>";
const endpoint = "https://inspirehep.net/api/literature/fields";

fetch(endpoint, { headers: { Authorization: `Bearer ${apiKey}` } })
  .then((response) => response.json())
  .then((data) => console.log(data));

Conclusion

In this tutorial, we learned how to use the Inspire API to fetch publications, authors and a list of fields that we can query for. With the help of the sample JavaScript code provided, you can easily get started with the Inspire API. Please refer to the API documentation for more endpoints and parameters that you can use to search and retrieve data from Inspire.

📊 30-Day Uptime History

Daily uptime tracking showing online vs offline minutes

Jul 5Jul 7Jul 9Jul 11Jul 13Jul 15Jul 17Jul 19Jul 21Jul 23Jul 25Jul 27Jul 29Jul 31Aug 304008001440Minutes
Online
Offline

Related APIs in Science