Show / Hide Table of Contents

Authentication

Every request sent to the Language Weaver Edge API must be authenticated, in one of two ways: (1) API key authentication, or (2) token authentication. If authentication fails, a 401 Unauthorized response will be returned. API key authentication allows you to make API requests immediately, while token authentication requires an extra step of first logging in to obtain an access token before making API requests.

API key authentication

# replace <api-key> with a valid API key
curl -u <api-key>: "https://controller-host:8001/api/v2/translations"

One method of authenticating API requests is by supplying a valid API key. Each admin user has a unique API key. To obtain your API key, log in to the Language Weaver Edge Web GUI as an admin user and click to [Username] > My Account, where the API key is displayed. You can easily change your API key on that page as well.

The API uses HTTP Basic Authentication for API key authentication, so you need to specify your API key as the username and leave the password blank.

Make sure to keep your API key secret since it provides full access to the API. In case the API key gets into the wrong hands, or for any other reason, you can change your API key from the My Account page.

The vast majority of the API examples below use API key authentication.

Token authentication

# login with username and password
curl -X POST https://controller-host:8001/api/v2/auth -d username="jsmith@example.com" -d password="mypassword"
# => returns token

# replace <token> with returned token
curl -H "Authorization: Bearer <token>" "https://controller-host:8001/api/v2/translations"

Another method of authenticating API requests is by supplying a valid access token. To obtain an access token, first log in by passing your username and password to the POST /api/v2/auth endpoint, which will return a valid access token that expires after 30 days.

The API uses Bearer Token Authentication for token authentication, so this access token must be specified in an Authorization: Bearer header in each of your API requests.

In This Page
Back to top