[ Resources / Documentation / Getting Started ]

Getting Started with LocaleNLP API

Authenticate, make your first request, and understand response formats in under 10 minutes. Working code samples in Python, JavaScript, and cURL.

Guide10 min read

Introduction

LocaleNLP provides a suite of APIs for natural language processing optimized for African and Arabic languages. Our APIs enable speech recognition, text-to-speech, translation, and named entity recognition in 50+ language variants.

This guide walks through authentication, making your first API call, and choosing a client library. All endpoints are REST-based with JSON request/response.

01 / Authentication

Authentication

All requests require an API key sent as a Bearer token. Keys are scoped per project and rotatable from the dashboard.

Step 1 — Create an API key
  1. 01.Sign up or log in to the LocaleNLP Developer Portal
  2. 02.Navigate to Settings → API Keys
  3. 03.Click Create new key and assign a project scope
  4. 04.Copy and store securely — shown only once
Authorization header format
~/api/auth-header
Authorization: Bearer YOUR_API_KEY
HTTP
02 / First API Call

First API Call — Language Detection

Let's detect the language of a Swahili text sample. Returns the top-3 candidates with confidence scores.

~/POST /v1/text/detect-language
curl -X POST https://api.localenlp.com/v1/text/detect-language \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Habari gani? Jina langu ni LocaleNLP."}'
cURL
~/200 OK — application/json
{
  "language": "sw",
  "language_name": "Swahili",
  "confidence": 0.98,
  "latency_ms": 3
}
JSON
03 / Client Libraries

Client Libraries

Official SDK clients are available in four languages. Install once, import, and make requests without managing headers manually.

Python
pip install localenlp
JavaScript
npm install localenlp
Go
go get localenlp-go
Rust
cargo add localenlp