key query parameter, which is where the simple API expects it, not as a header.
Things to know before you call:
- A failure arrives with HTTP 200. Gender API puts
errnoanderrmsgin the body of every answer, with0on a good one. A live probe with a bad key answered 200 and{"errno":40,"errmsg":"invalid or missing key"}. The plugin throws whenever the code is non-zero, whatever the status was. - The documented codes are 10, 11, 20, 21, 30, 40 and 500. They cover an invalid country code, a country count that does not match the name count, a missing name, more than 100 names, a used-up quota, an unknown key, and their own internal failure.
GenderApiAPIErrorexposeserrnoso a caller can branch on them, andGENDER_API_ERRNOnames each one. - The quota is
errno: 30, not a 429. A limit that ran out answers 200 with the code and a link to the pricing page, so it is not retried. gendercan beunknown. The answer is still a success:samplesandaccuracytell you how weak the data is. Gender API never returns a null gender.- A country changes the answer.
Andreais male in Italy and female in Germany, andmultiaccepts one country for every name or one per name in the same order. - A name is normalized before lookup.
name_sanitizedis the form the database actually matched, which is worth reading when a result looks wrong. fullNamereturns a null last name understrict. Withstrict: trueGender API returns a nulllast_namewhen it is not in the database, instead of guessing one.
- 6 typed API operations
Setup
1
Install
2
Add the plugin
corsair.ts
multiTenancy: true, scope calls with corsair.withTenant(id). See Quick start for KEK + Hub keys, and Multi-tenancy for account isolation.3
Choose authentication
- API Key (Recommended)
Store the Gender API API key before the first call: More: API Key
pnpm corsair setup --plugin=genderapi --tenant=acme api_key=<your-key> (leave out --tenant without multiTenancy), or pass it as key in the plugin options. With Hub, each tenant enters their own key on the connect page. See API key auth.4
Connect a tenant
Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see Connect / OAuth.
Example API calls
Look up the gender behind one first nameWhat’s next
API reference
Every
genderapi.api.* operation with input and output types.Connect / OAuth
createLink, Hub delivery, and tenant connect flows.
Use with agents
Expose this plugin’s operations as MCP tools.