> ## Documentation Index
> Fetch the complete documentation index at: https://docs.olostep.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Answers API

Through the Olostep `/v1/answers` endpoint you can search the web with natural language and return AI‑powered answers and data in the JSON shape you want. This lets you ground your products on real-world data and sources, enrich data points or spreadsheets

* Ask a question or give AI a data point you want to enrich
* Optional: specify the JSON structure you want back

It will:

* Search, clean, validate and return the data it found on the Web
* Return sources used to generate the answer
* Handle uncertainty with `NOT_FOUND` values when data cannot be verified

For API details, see the [Answers Endpoint API Reference](/api-reference/answers/create).

By default we use a generic web index and a cost‑efficient LLM validator.

Enterprise customers have access to proprietary industry specific web indexes, exclusive private data (including phone numbers and emails) and custom LLM models most suited for their use case. Contact us for access: [info@olostep.com](mailto:info@olostep.com)

## Use cases

The answers endpoint can be used to:

* Ground AI applications on real world data and facts
* Enrich spreadsheets and data points for Recruting, Finance, Consulting, and Sales

Here's a demo of an AI powered spreadsheet powered by the Answers endpoint:
[https://www.olostep.com/demos/spreadsheet-enrich](https://www.olostep.com/demos/spreadsheet-enrich)

## Installation

<CodeGroup>
  ```python Python theme={null}
  pip install olostep
  ```

  ```javascript Node theme={null}
  npm install olostep
  ```

  ```bash cURL theme={null}
  # curl is available by default on macOS, Linux, and Windows
  ```

  ```javascript Node (API) theme={null}
  npm install node-fetch
  ```

  ```bash Python (API) theme={null}
  pip install requests
  ```
</CodeGroup>

## Usage

Ask a question and pass a JSON schema to guide the output. You can also not pass the `json` parameter and the API will return a json object with the answer text inside the `result` field.

<CodeGroup>
  ```python Python theme={null}
  from olostep import Olostep

  client = Olostep(api_key="YOUR_REAL_KEY")

  answer = client.answers.create(
      task="What is the latest book by J.K. Rowling?",
      json_format={"book_title": "", "author": "", "release_date": ""},
  )

  print(answer.json_content)
  print(answer.sources)
  ```

  ```js Node theme={null}
  import Olostep from 'olostep'

  const client = new Olostep({ apiKey: 'YOUR_REAL_KEY' })

  const answer = await client.answers.create({
    task: 'What is the latest book by J.K. Rowling?',
    jsonFormat: { book_title: '', author: '', release_date: '' },
  })

  console.log(answer.json_content)
  console.log(answer.sources)
  ```

  ```bash cURL theme={null}
  curl -s -X POST "https://api.olostep.com/v1/answers" \
    -H "Authorization: Bearer $OLOSTEP_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "task": "What is the latest book by J.K. Rowling?",
      "json": {"book_title": "", "author": "", "release_date": ""}
    }'
  ```

  ```js Node (API) theme={null}
  const res = await fetch('https://api.olostep.com/v1/answers', {
    method: 'POST',
    headers: { 'Authorization': 'Bearer <YOUR_API_KEY>', 'Content-Type': 'application/json' },
    body: JSON.stringify({
      task: 'What is the latest book by J.K. Rowling?',
      json: { book_title: '', author: '', release_date: '' }
    })
  })
  console.log(await res.json())
  ```

  ```python Python (API) theme={null}
  import requests, json

  endpoint = "https://api.olostep.com/v1/answers"
  payload = {
    "task": "What is the latest book by J.K. Rowling?",
    "json": {"book_title": "", "author": "", "release_date": ""}
  }
  headers = {"Authorization": "Bearer <YOUR_API_KEY>", "Content-Type": "application/json"}

  response = requests.post(endpoint, json=payload, headers=headers)
  print(json.dumps(response.json(), indent=2))
  ```
</CodeGroup>

## Response

Like other Olostep endpoints, you will receive a `answer` object in response. The `answer` object has a few properties like `id` and `result`.

```json theme={null}
{
  "id": "answer_9bi0sbj9xa",
  "object": "answer",
  "created": 1760327323,
  "metadata": {},
  "task": "What is the latest book by J.K. Rowling?",
  "result": {
    "json_content": "{\"book_title\":\"The Hallmarked Man\",\"author\":\"J.K. Rowling (as Robert Galbraith)\",\"release_date\":\"2 September 2025\"}",
    "json_hosted_url": "https://olostep-storage.s3.us-east-1.amazonaws.com/answer_9bi0sbj9xa.json",
    "sources": [
      "https://strikefans.com/the-books/",
      "https://www.facebook.com/groups/496943608606523/posts/1136830134617864/",
      "https://robert-galbraith.com/strike-books/",
      "https://www.novelsuspects.com/series-list/robert-galbraith-cormoran-strike-series-in-order/",
      "https://www.reddit.com/r/books/comments/1na833a/jk_rowlings_new_strike_novel_900_pages_of_romance/",
      "https://www.harrypotter.com/writing-by-jk-rowling",
      "https://stories.jkrowling.com/book-news/",
      "https://deadline.com/2024/09/jk-rowling-writing-futuristic-novel-1236093909/",
      "https://www.reddit.com/r/FantasticBeasts/comments/1cl1shn/jk_rowling_may_2024_ive_got_six_more_books_in_my/",
      "https://www.jkrowling.com/news/"
    ]
  }
}
```

Your requested answer, formatted according to the `json` parameter, is in `response.result.json_content` and the list of sources in `response.result.sources`. You can parse the stringified JSON to access the structured data.

```json theme={null}
{
  "book_title": "The Hallmarked Man",
  "author": "J.K. Rowling",
  "release_date": "September 2, 2025"
}
```

Sources example:

```json theme={null}
[
    "https://www.harrypotter.com/writing-by-jk-rowling",
    "https://stories.jkrowling.com/book-news/",
    "https://deadline.com/2024/09/jk-rowling-writing-futuristic-novel-1236093909/",
    "https://www.reddit.com/r/FantasticBeasts/comments/1cl1shn/jk_rowling_may_2024_ive_got_six_more_books_in_my/",
    "https://www.jkrowling.com/news/"
]
```

When you don't pass the `json` parameter, the API will return a json object with the answer text inside the `result` field.

```json theme={null}
{
  "result": "The latest book by J.K. Rowling is The Hallmarked Man."
}
```

### Flexible `json` parameter

* Provide a JSON object with empty values as a schema, or a string describing the data you want.
* If the agent isn’t confident, it returns `NOT_FOUND` for that field.

<CodeGroup>
  ```python Python theme={null}
  from olostep import Olostep

  client = Olostep(api_key="YOUR_REAL_KEY")

  answer = client.answers.create(
      task="how much did Olostep raise?",
      json_format={"amount": ""},
  )

  print(answer.json_content)
  ```

  ```js Node theme={null}
  import Olostep from 'olostep'

  const client = new Olostep({ apiKey: 'YOUR_REAL_KEY' })

  const answer = await client.answers.create({
    task: 'how much did Olostep raise?',
    jsonFormat: { amount: '' },
  })

  console.log(answer.json_content)
  ```

  ```python Python (API) theme={null}
  import requests, json

  endpoint = "https://api.olostep.com/v1/answers"
  payload = {
    "task": "how much did Olostep raise?", 
    "json": {
      "amount": ""
    }
  }
  headers = {
    "Authorization": "Bearer <YOUR_API_KEY>",
    "Content-Type": "application/json"
  }
  response = requests.post(endpoint, json=payload, headers=headers)
  print(json.dumps(response.json(), indent=2))
  ```
</CodeGroup>

This would return:

```json theme={null}
{
  "amount": "NOT_FOUND"
}
```

## Pricing

Answers costs 20 credits per request.
