Quickstart

The NextGen documentation is still under construction.

The Acrolinx NextGen API makes it easy to validate that your content meets your standards, or fix it if it doesn’t. Follow this guide to get started with the API.

Using the NextGen API

1

Get Your API Key

If you are a part of our Lighthouse Program, you should have already been provided an API key. Otherwise, sign up for the beta here.

2

Install the SDK

$npm install acrolinx-nextgen-api # or use the package manager of your choosing
3

Check Your First Document

Create a new file to get started.

In this example we’re using the AP style guide. If you’d like to use your own, you can upload a style guide to the Create Style Guide endpoint and replace the style_guide ID below.

1// example.ts
2
3 import * as fs from "fs";
4 import { acrolinxClient } from "acrolinx-nextgen-api";
5
6 const client = new acrolinxClient({
7 token: "YOUR_API_TOKEN",
8 });
9
10 const sleep = (seconds) =>
11 new Promise((resolve) => setTimeout(resolve, seconds * 1000));
12
13 const main = async () => {
14 const response = await client.styleRewrites.createStyleRewrite(
15 fs.createReadStream("/path/to/your/file.txt""),
16 {
17 dialect: "american_english",
18 tone: "formal",
19 style_guide: "chicago",
20 },
21 {}
22 );
23
24 for (let i = 0; i < 12; i++) {
25 console.log("Waiting for file to process...");
26 await sleep(5);
27
28 const statusResponse = await client.styleRewrites.getStyleRewrite(
29 response.workflow_id,
30 {}
31 );
32 const status = statusResponse.status ?? "";
33
34 if (["failed", "not_found"].includes(status as string)) {
35 console.log("Document failed to process.");
36 process.exit(1);
37 }
38
39 if (status === "completed") {
40 console.log(statusResponse);
41 process.exit();
42 }
43 }
44 };
45
46 main();
4

Run the code

$npx tsx example.ts