# Getting started

Find papers and search the literature with one API key.

The Anara API provides paper lookup and academic search. Search in instant, standard, or deep mode. Full-text passages and hosted PDFs are available only for open-access papers with content in our index.

Try the [playground](https://platform.anara.com/playground) with your Anara sign-in. An API key is only needed when calling the API from your own application.

Use the API URL shown in **Get code** in your console. Preview keys belong to the preview environment and do not authenticate against the production API.

Add prepaid credit in the console to use paid endpoints. See [Billing](/api/billing).

## 1. Get a key [#1-get-a-key]

Create a key in the console under [API keys](https://platform.anara.com/keys). Keys start with `ana_live_`. The full key is shown once, at creation. After that the console shows only the prefix.

Send the key as a bearer token or in the `X-API-Key` header.

```http title="Header"
Authorization: Bearer $ANARA_API_KEY
```

A missing, unknown, or revoked key answers `401`. A key without the scope for the product answers `403`. See [Keys and scopes](/api/keys).

## 2. Make a request [#2-make-a-request]

<CodeGroup>
  ```bash title="cURL"
  curl -X POST https://api.anara.com/v1/search \
    -H "Authorization: Bearer $ANARA_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"query": "transformer attention efficiency", "maxResults": 5}'
  ```

  ```python title="Python"
  import os
  import requests

  response = requests.post(
      "https://api.anara.com/v1/search",
      headers={"Authorization": f"Bearer {os.environ['ANARA_API_KEY']}"},
      json={"query": "transformer attention efficiency", "maxResults": 5},
  )
  print(response.json())
  ```

  ```ts title="TypeScript"
  const response = await fetch('https://api.anara.com/v1/search', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.ANARA_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      query: 'transformer attention efficiency',
      maxResults: 5,
    }),
  });
  console.log(await response.json());
  ```
</CodeGroup>

```json title="Response"
{
  "papers": [
    {
      "id": "W2963403868",
      "title": "Attention Is All You Need",
      "authors": ["Ashish Vaswani", "Noam Shazeer"],
      "year": 2017,
      "doi": "10.48550/arxiv.1706.03762",
      "citedByCount": 98000,
      "openAccess": true,
      "hasFulltext": true
    }
  ],
  "totalApprox": 1,
  "charge": { "costMicroUsd": 5000, "balanceMicroUsd": 9995000 }
}
```

Every metered response carries a `charge` object: what the call cost and what is left, both in micro-dollars (1 USD = 1,000,000).

## 3. Read the reference [#3-read-the-reference]

<Cards>
  <Card title="Lookup by id" href="/api/resolve" description="Resolve DOIs, arXiv, OpenAlex, PubMed ids, or exact titles to papers." />

  <Card title="Search" href="/api/search" description="Search the academic index with filters." />

  <Card title="Billing" href="/api/billing" description="Prepaid credit, the rate card, and top-ups." />

  <Card title="OpenAPI and SDKs" href="/api/openapi" description="Generate a client from the spec." />
</Cards>

## Copy documentation [#copy-documentation]

Use **Copy page as text**, [llms.txt](/llms.txt), or [llms-full.txt](/llms-full.txt). Each documentation page is also available at `/<slug>.md`.
