MyNixOS website logo
Description

Client for 'GenderAPI.io'.

Provides an interface to the 'GenderAPI.io' web service (<https://www.genderapi.io>) for determining gender from personal names, email addresses, or social media usernames. Functions are available to submit single or batch queries and retrieve additional information such as accuracy scores and country-specific gender predictions. This package simplifies integration of 'GenderAPI.io' into R workflows for data cleaning, user profiling, and analytics tasks.

genderapi-R

Official R Client for GenderAPI.io โ€” determine gender from names, emails, and usernames using AI, including bulk operations for high-volume analysis.


โœ… Get a Free API Key:
https://app.genderapi.io


๐Ÿš€ Installation

Since the package is not yet on CRAN, install directly from GitHub using {devtools}.

Install {devtools} if you donโ€™t have it:

install.packages("devtools")

Then install genderapi-R:

devtools::install_github("GenderAPI/genderapi-R")

Load the package:

library(genderapi)

โš ๏ธ Required Packages

Make sure you have these installed:

install.packages(c("httr", "jsonlite"))

Example

library(genderapi)

api_key <- "YOUR_API_KEY"

result <- get_gender_by_name(
  api_key = api_key,
  name = "Michael"
)

print(result)

๐Ÿ”— Load the Library

library(genderapi)

๐Ÿ“ Usage

๐Ÿ”น Get Gender by Name

api_key <- "YOUR_API_KEY"

result <- get_gender_by_name(
  api_key = api_key,
  name = "Michael"
)

print(result)

With Additional Options

result <- get_gender_by_name(
  api_key = api_key,
  name = "ๆŽ้›ท",
  country = "CN",
  askToAI = TRUE,
  forceToGenderize = TRUE
)

print(result)

๐Ÿ”น Get Gender by Email

result <- get_gender_by_email(
  api_key = api_key,
  email = "[email protected]"
)

print(result)

With askToAI

result <- get_gender_by_email(
  api_key = api_key,
  email = "[email protected]",
  askToAI = TRUE
)

print(result)

๐Ÿ”น Get Gender by Username

result <- get_gender_by_username(
  api_key = api_key,
  username = "michael_dev"
)

print(result)

With Additional Options

result <- get_gender_by_username(
  api_key = api_key,
  username = "michael_dev",
  country = "US",
  askToAI = TRUE,
  forceToGenderize = TRUE
)

print(result)

๐Ÿ”น Get Gender by Name (Bulk)

Lookup up to 100 names in a single request.

data <- list(
  list(name = "Andrea", country = "DE", id = "123"),
  list(name = "andrea", country = "IT", id = "456"),
  list(name = "james", country = "US", id = "789")
)

result <- get_gender_by_name_bulk(
  api_key = api_key,
  data = data
)

print(result)

๐Ÿ”น Get Gender by Email (Bulk)

Lookup up to 50 emails in a single request.

data <- list(
  list(email = "[email protected]", country = "US", id = "abc123"),
  list(email = "[email protected]", country = "DE", id = "def456")
)

result <- get_gender_by_email_bulk(
  api_key = api_key,
  data = data
)

print(result)

๐Ÿ”น Get Gender by Username (Bulk)

Lookup up to 50 usernames in a single request.

data <- list(
  list(username = "cooluser", country = "US", id = "u001"),
  list(username = "maria2025", country = "DE", id = "u002")
)

result <- get_gender_by_username_bulk(
  api_key = api_key,
  data = data
)

print(result)

๐Ÿ“ฅ API Parameters

Below are the parameters accepted by each function.

Name Lookup

ParameterTypeRequiredDescription
nameStringYesName to query.
countryStringNoTwo-letter country code (e.g. "US").
askToAILogicalNoDefault FALSE. If TRUE, queries AI directly (costs 3 credits).
forceToGenderizeLogicalNoDefault FALSE. If TRUE, attempts to analyze nicknames, emojis, etc.

Name Lookup (Bulk)

ParameterTypeRequiredDescription
dataList of named listsYesEach item contains name (required), country (optional), and id (optional). Max 100 records.

Email Lookup

ParameterTypeRequiredDescription
emailStringYesEmail address to query.
countryStringNoTwo-letter country code.
askToAILogicalNoDefault FALSE.

Email Lookup (Bulk)

ParameterTypeRequiredDescription
dataList of named listsYesEach item contains email (required), country (optional), and id (optional). Max 50 records.

Username Lookup

ParameterTypeRequiredDescription
usernameStringYesUsername to query.
countryStringNoTwo-letter country code.
askToAILogicalNoDefault FALSE.
forceToGenderizeLogicalNoDefault FALSE.

Username Lookup (Bulk)

ParameterTypeRequiredDescription
dataList of named listsYesEach item contains username (required), country (optional), and id (optional). Max 50 records.

โœ… API Response

All functions return a list representing the JSON response.

Single lookup example:

list(
  status = TRUE,
  used_credits = 1,
  remaining_credits = 4999,
  expires = 1743659200,
  q = "[email protected]",
  name = "Michael",
  gender = "male",
  country = "US",
  total_names = 325,
  probability = 98,
  duration = "4ms"
)

Bulk lookup example:

list(
  status = TRUE,
  used_credits = 3,
  remaining_credits = 7265,
  expires = 1717069765,
  names = list(
    list(
      name = "andrea",
      q = "Andrea",
      gender = "female",
      country = "DE",
      total_names = 644,
      probability = 88,
      id = "123"
    ),
    list(
      name = "andrea",
      q = "andrea",
      gender = "male",
      country = "IT",
      total_names = 13537,
      probability = 98,
      id = "456"
    )
  ),
  duration = "5ms"
)

๐Ÿ”Ž Response Fields

FieldTypeDescription
statusLogicalTRUE or FALSE. Indicates success.
used_creditsIntegerCredits used for the request.
remaining_creditsIntegerCredits left.
expiresIntegerUnix timestamp of account expiry.
qStringOriginal query input.
nameStringFound name.
genderString"male", "female", or "null".
countryStringPredicted country code.
total_namesIntegerNumber of records used in prediction.
probabilityIntegerConfidence (50โ€“100).
durationStringProcessing time.

โš ๏ธ Error Handling

If an error occurs, the API returns:

list(
  status = FALSE,
  errno = 94,
  errmsg = "invalid or missing key"
)

Common error codes:

errnoerrmsgDescription
50access deniedUnauthorized IP or referrer.
90invalid country codeInvalid country code.
91name not set || email not setMissing input field.
92too many names || too many emailsExceeded bulk limits.
93limit reachedAPI key credits exhausted.
94invalid or missing keyInvalid API key.
99API key has expiredRenew your key.

๐Ÿ’ป Troubleshooting

  • Check internet connection.
  • Ensure your API key is correct.
  • Confirm required R packages are installed:
    install.packages(c("httr", "jsonlite"))
    

๐Ÿ”— Live Test Pages


๐Ÿ“š Detailed API Documentation

See full API docs:

https://www.genderapi.io/api-documentation


โš–๏ธ License

MIT License.

Metadata

Version

1.0.3

License

Unknown

Platformsย (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows