SDK BillionVerify Get an API key

ai-connectors

Vercel Connect Connector

By BillionVerify Team · Last reviewed

The BillionVerify connector for Vercel Connect stores your API key once at the team level. Linked projects request the key at runtime, so no project keeps its own copy.

Add the connector

  1. Create an API key on the API Keys page. Give it a name such as vercel-production.
  2. Open the BillionVerify listing, or search for “billionverify” under Connect in your Vercel dashboard.
  3. Name the connector, for example billionverify-prod. Your connector ID becomes billionverify/billionverify-prod.
  4. Choose Shared API Keys or Per-User API Keys, paste the key and create the connector.
  5. Link the projects and environments that may verify emails. A project that is not linked gets an error instead of a key.

Set it up from the CLI

Run these commands from the project that will use the connector.

vercel link
vercel connect create billionverify --name billionverify-prod
vercel env pull

vercel env pull writes a short-lived development token to .env.local, so getToken also works on your own machine. That file holds a Vercel token, not your BillionVerify key.

Choose a key type

Key type Use it when Credits come from
Shared API Keys Your own product does the verifying Your BillionVerify account
Per-User API Keys Your users have their own BillionVerify accounts Each user’s account

Verify an email from your code

Install the Vercel Connect SDK.

npm install @vercel/connect

Request the key with getToken, then send it in the BV-API-KEY header.

// app/api/verify-email/route.ts
import { getToken } from '@vercel/connect';

export async function POST(req: Request) {
  const { email } = await req.json();

  const apiKey = await getToken('billionverify/billionverify-prod', {
    subject: { type: 'app' },
  });

  const res = await fetch('https://api.billionverify.com/v1/verify/single', {
    method: 'POST',
    headers: { 'BV-API-KEY': apiKey, 'Content-Type': 'application/json' },
    body: JSON.stringify({ email, check_smtp: true }),
  });

  const body = await res.json();
  return Response.json(body.data);
}

The SDK caches the key in memory, so it does not call Vercel Connect again for every address.

To see what a response should look like before you deploy, try one address in BillionVerify’s browser checker.

Use per-user keys

Pass the signed-in user’s ID as the subject.

const apiKey = await getToken('billionverify/billionverify-prod', {
  subject: { type: 'user', id: session.user.id },
});

If the user has not provided a key yet, the SDK throws UserAuthorizationRequiredError. Catch it and show a step that connects their BillionVerify account.

Other endpoints

The same key works for every endpoint.

To run a live SMTP check on one address by hand rather than from code, use the free verifier page. It needs no key.

Credits

Verifications through the connector use the credits in your BillionVerify account at the normal rate. Unknown results cost nothing. Vercel bills its own token requests separately under Vercel Connect pricing.