# Call a JSON REST API with a bearer token

**Use case:** 

Send GET requests to a REST API you are authorized to use, with your API key in an encrypted secret field sent as an Authorization: Bearer header. List the endpoint URLs and get one dataset record per URL with status, headers and the parsed JSON body. Add your own key after you duplicate the task; no key is stored in this task.

## Input

```json
{
  "requests": [
    "https://httpbin.org/get"
  ],
  "method": "GET",
  "requestBody": "",
  "bodyContentType": "application/json",
  "apiKeyIn": "bearer",
  "apiKeyHeaderName": "X-API-Key",
  "apiKeyQueryParam": "api_key",
  "followRedirects": true,
  "maxRedirects": 5,
  "timeoutSecs": 30,
  "maxResponseBytes": 1048576,
  "responseFormat": "json",
  "includeResponseHeaders": true,
  "maxConcurrency": 3,
  "credentialOwnershipAttestation": false
}
```

## Output

```json
{
  "index": {
    "label": "#",
    "format": "number"
  },
  "url": {
    "label": "URL",
    "format": "link"
  },
  "status": {
    "label": "Status",
    "format": "text"
  },
  "httpStatus": {
    "label": "HTTP",
    "format": "number"
  },
  "ok": {
    "label": "Ok"
  },
  "charged": {
    "label": "Charged",
    "format": "boolean"
  },
  "chargedEvents": {
    "label": "Charged events"
  },
  "request.method": {
    "label": "Method"
  },
  "response.status": {
    "label": "Status"
  },
  "response.contentType": {
    "label": "Content type"
  },
  "response.bytes": {
    "label": "Bytes"
  },
  "requestMs": {
    "label": "Request ms"
  },
  "finalUrl": {
    "label": "Final url"
  },
  "error": {
    "label": "Error"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The HTTP API Request Runner Actor is ready to run with the inputs already set for "Call a JSON REST API with a bearer token". [Sign up or log in](https://console.apify.com/create-task-from-example/s3Efm2HedNNgD2pMP) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Call a JSON REST API with a bearer token" task

The HTTP API Request Runner Actor will start running based on the input automatically. You can also change all the input fields, like request urls, HTTP method, and more, to match your specific use case.

### 3. Receive the "Call a JSON REST API with a bearer token" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as #, URL, status, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Call a JSON REST API with a bearer token" task via API](https://apify.com/luxe_tasks/http-runner.md).

## FAQ

### Where does my API key go in the Call a JSON REST API with a bearer token task?

In the Call a JSON REST API with a bearer token task, paste the key into the API key (secret) field; it is an encrypted Apify secret input that is never logged or returned.

### How much does calling an API with this task cost?

The Call a JSON REST API with a bearer token task costs $2 per 1,000 requests answered 2xx or 3xx plus a start fee of $0.005 per run at the default 1 GB of memory; failed requests have no per-request charge.

### Can the task call APIs I'm not authorized to use?

You must not. The Call a JSON REST API with a bearer token task is only for APIs and accounts you own or are authorized to use, under the API's terms.

## About this Actor

This example demonstrates how to use [HTTP API Request Runner](https://apify.com/luxe_tasks/http-runner.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/luxe_tasks/http-runner.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/luxe_tasks/http-runner.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
