# 23andme

> JavaScript wrapper for the 23andMe API.

Latest version **1.1.0** (published 2016-04-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install 23andme
pnpm add 23andme
yarn add 23andme
bun add 23andme
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2016-04-18 |
| First published | 2013-09-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Luke Horvat |
| Maintainers | lukehorvat |
| Keywords | 23andme, api, node, node.js, wrapper, client, biology, genomics, genome, dna |

## Links

- npm: https://www.npmjs.com/package/23andme
- Repository: https://github.com/lukehorvat/23andme
- Homepage: https://github.com/lukehorvat/23andme#readme
- Issues: https://github.com/lukehorvat/23andme/issues
- npm.io page: https://npm.io/package/23andme

## Dependencies (2)

- [got](https://npm.io/package/got.md) 6.3.0
- [form-data](https://npm.io/package/form-data.md) 1.0.0-rc4

## 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.1.0 (latest) — 2016-04-18
- 1.0.1 — 2016-04-16
- 1.0.0 — 2016-04-15
- 0.0.0 — 2013-09-05

## README

# 23andme [![NPM version](http://img.shields.io/npm/v/23andme.svg?style=flat-square)](https://www.npmjs.org/package/23andme)

JavaScript wrapper for the [23andMe API](https://api.23andme.com).

## Installation

Install the package with NPM:

```bash
$ npm install 23andme
```

## Usage

Minimal example:

```javascript
import API from "23andme";

let clientId = "fake_client_id";
let clientSecret = "fake_client_secret";
let redirectUri = "http://localhost:9000/receive_code";
let scope = ["ancestry"];
let api = new API(clientId, clientSecret, redirectUri, scope);

function receiveCode(code) {
  api.auth(code)
  .then(() => api.ancestry())
  .then(ancestry => console.log(ancestry))
  .catch(err => console.error(err));
}
```

As can be seen, the package exposes an API wrapper class that can be instantiated. This class has the following methods:

* `constructor(clientId, clientSecret, redirectUri, scope)`
  * Creates an instance of the class.
* `auth(code)`
  * Authenticates with the 23andMe API by exchanging an authorization code for an authorization token.
  * Returns a Promise of the authorization token.
  * Call this method first before you make any API requests!
* `user()`
  * Retrieves data from the API's `/user` endpoint.
  * Returns a Promise of the endpoint's response data.
* `names()`
  * Retrieves data from the API's `/names` endpoint.
  * Returns a Promise of the endpoint's response data.
* `haplogroups()`
  * Retrieves data from the API's `/haplogroups` endpoint.
  * Returns a Promise of the endpoint's response data.
* `ancestry()`
  * Retrieves data from the API's `/ancestry` endpoint.
  * Returns a Promise of the endpoint's response data.
* `familyMembers()`
  * Retrieves data from the API's `/family_members` endpoint.
  * Returns a Promise of the endpoint's response data.
* `relatives()`
  * Retrieves data from the API's `/relatives` endpoint.
  * Returns a Promise of the endpoint's response data.

And the following properties:

* `authUri`
  * The URI to redirect the user's Web browser to in order for them to login to 23andMe and be granted an authorization code. (When 23andMe sends the authorization code to your server, pass it to the `auth()` method!)
* `baseUri`
  * The base URI of the 23andMe API.
* `token`
  * The authorization token granted when `auth()` was called.

## Disclaimer

The package is not officially affiliated with 23andMe in any way. Use at own risk.

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