# io

> Simple HTTP API: GET, POST, PUT, DELETE, PATCH

Latest version **1.5.9** (published 2026-11-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install io
pnpm add io
yarn add io
bun add io
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.5.9 |
| Published | 2026-11-10 |
| First published | 2015-07-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 28.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Keith Horwood |
| Maintainers | keithwhor |
| Keywords | http, api |

## Links

- npm: https://www.npmjs.com/package/io
- npm.io page: https://npm.io/package/io

## Dependencies (1)

- [mime](https://npm.io/package/mime.md) ^3.0.0

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.5.9 (latest) — 2026-11-10
- 1.5.8 — 2026-02-05
- 1.5.7 — 2025-08-15
- 1.5.6 — 2025-08-01
- 1.5.5 — 2025-07-31
- 1.5.4 — 2025-07-31
- 1.5.3 — 2024-08-18
- 1.5.2 — 2024-08-08
- 1.5.1 — 2024-08-01
- 1.5.0 — 2023-06-29
- 1.4.1 — 2023-05-23
- 1.4.0 — 2023-05-23
- 1.3.2 — 2023-03-21
- 1.3.1 — 2023-03-21
- 1.3.0 — 2023-03-05
- … 24 more at https://npm.io/package/io/versions

## README

# io

**io** is a simple Node.js HTTP wrapper for API calls.

Methods supported are...

```javascript
const io = require('io');

io.request(method, url, queryParams = {}, headers = null, body = null);
io.get(url, authorization = null, headers = null, queryParams = {});
io.del(url, authorization = null, headers = null, queryParams = {});
io.post(url, authorization = null, headers = null, params = {});
io.put(url, authorization = null, headers = null, params = {});
```

All requests return a `Promise` and can be run synchronously using `await`.

```javascript
let result = await io.request(method, url, queryParams = {}, headers = null, body = null);
```

## request

The `request` method takes a raw `body` string and sends no `content-type` by default.

It returns a result with the following schema;

```json
{
  "statusCode": 200,
  "headers": {},
  "body": ""
}
```

## get, del

The `get` and `del` methods will populate the URL querystring with `x-www-urlencoded`
values based on a `queryParams` object. They will send a
`content-type: application/json` header by default.

The `authorization` parameter will set the `authorization` HTTP header. If this
value begins with the strings `Basic ` or `Bearer `, the full value will be used.
Otherwise, `Bearer ` will be prepended. Sending `authorization = "x"`, for example,
will populate the `authorization` header with a value of `Bearer x`.

**NOTE:** If the requested resource does not return JSON data, an error will be thrown.

They return a result with the following schema;

```json
{
  "statusCode": 200,
  "headers": {},
  "data": {}
}
```

## post, put

The `post` and `put` methods will populate the post body with `application/json`
values based on a `params` object. They will send a
`content-type: application/json` header by default.

The `authorization` parameter will set the `authorization` HTTP header. If this
value begins with the strings `Basic ` or `Bearer `, the full value will be used.
Otherwise, `Bearer ` will be prepended. Sending `authorization = "x"`, for example,
will populate the `authorization` header with a value of `Bearer x`.

**NOTE:** If the requested resource does not return JSON data, an error will be thrown.

They return a result with the following schema;

```json
{
  "statusCode": 200,
  "headers": {},
  "data": {}
}
```

# Thanks!

&copy; 2020 Standard Library (Polybit Inc.)

---
_Source: https://npm.io/package/io · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
