Continue → Overview

Client libraries

Thin wrappers over the REST API. They handle retries, batching and encoding, so you do not have to.

You do not need one. The API is four endpoints and plain JSON; a library saves you an afternoon, not a project. If your language is not listed, the REST reference has copy-paste examples.

REST API Reference →
JavaScript
Node.js · Deno · Bun · npm
Install
npm install github:anpekesen/namegender-js#v0.2.0
Usage
import { NameGender } from 'namegender';

const client = new NameGender('YOUR_API_KEY');

const result = await client.name('Ayşe', { country: 'TR' });
console.log(result.gender);      // "female"
console.log(result.confidence);  // "unverified" | "low" | "medium" | "high"

// Tek istekte çok isim
const many = await client.bulk(['Ayşe', 'Mehmet', 'Priya']);
PHP
PHP 8.1+
Install
composer config repositories.namegender vcs https://github.com/anpekesen/namegender-php
composer require namegender/namegender:^0.2
Usage
use NameGender\Client;

$client = new Client('YOUR_API_KEY');

$result = $client->name('Ayşe', country: 'TR');
echo $result['gender'];      // "female"
echo $result['confidence'];  // "unverified" | "low" | "medium" | "high"

// Tek istekte çok isim
$many = $client->bulk(['Ayşe', 'Mehmet', 'Priya']);
Python
Python 3.9+
Install
pip install git+https://github.com/anpekesen/namegender-python.git@v0.2.0
Usage
from namegender import NameGender

client = NameGender("YOUR_API_KEY")

result = client.name("Ayşe", country="TR")
print(result["gender"])      # "female"
print(result["confidence"])  # evidence level

# Tek istekte çok isim
many = client.bulk(["Ayşe", "Mehmet", "Priya"])
Ruby
Ruby 3.0+
Install
git clone --branch v0.2.0 https://github.com/anpekesen/namegender-ruby.git
cd namegender-ruby && gem build namegender.gemspec && gem install namegender-0.2.0.gem
Usage
require "namegender"

client = NameGender::Client.new("YOUR_API_KEY")

result = client.name("Ayşe", country: "TR")
puts result["gender"]      # "female"
puts result["confidence"]  # evidence level
Java
Java 17+ · JitPack
Install
<repository>
  <id>jitpack.io</id>
  <url>https://jitpack.io</url>
</repository>

<dependency>
  <groupId>com.github.anpekesen</groupId>
  <artifactId>namegender-java</artifactId>
  <version>v0.2.0</version>
</dependency>
Usage
var client = new NameGender("YOUR_API_KEY");

var result = client.name("Ayşe", "TR");
System.out.println(result.gender());       // "female"
System.out.println(result.confidence());
Go
Go 1.21+
Install
go get github.com/anpekesen/namegender-go@v0.2.0
Usage
client := namegender.New("YOUR_API_KEY")

result, err := client.Name(ctx, "Ayşe", namegender.Options{Country: "TR"})
fmt.Println(result.Gender)      // "female"
fmt.Println(result.Confidence)
R
R 4.1+ · GitHub
Install
remotes::install_github('anpekesen/namegender-r', ref = 'v0.2.0')
Usage
library(namegender)

client <- namegender("YOUR_API_KEY")

result <- ng_name(client, "Ayşe", country = "TR")
result$gender       # "female"
result$confidence

# Bir data frame'in tamamını tek çağrıda
df$gender <- ng_bulk(client, df$name)$gender

Need another language?

Tell us which one and we will look at it. The API surface is small enough that a community wrapper is a weekend of work, and we will link it here.

Contact support