TSGGLOBAL Support sign in
Skip to page content
Browse TNID API docs

TNID API documentation Getting Started Guide

Getting Started Guide

On this page

The five steps from nothing to a working TNID integration: user login, company creation, company credentials, first calls, and where to point requests.

What you will use

  • Auth endpoints: /auth/create-user-otp, /auth/token, /auth/refresh-token
  • GraphQL servers: /user (for people) and /company (for businesses)
  • Hosts: https://api.staging.v2.tnid.com for staging, https://api.zero.v2.tnid.com for the zero (pre-production) environment. See API Quick Reference for the full picture.

You can try everything with Postman first: see Accessing via Postman.


1) Create (or claim) your individual profile

Think of this as getting your user login.

Step A: request a one-time code (OTP). Send your phone number or email (and, if you are creating a new user, first name, last name and email) to /auth/create-user-otp. You receive an OTP.

Step B: exchange the OTP for a Bearer token. Send your telephone_number (or email) and otp_code to /auth/token. You get an access_token that lets you call the /user GraphQL API, plus a refresh_token. Save both securely.

Details and code: User Authentication.

Optional: update your user profile. With your user token, call the updateUser mutation on /user to set firstName, lastName, username or aboutMe. See Update User profile.


2) Create your company (as that user)

Once you have a user token, you can create a company and mint credentials for it.

Step A: create the company profile. Call the createCompany mutation on /user with the basics (legalName, profileName, optional brandName, taxId, and so on). If you include provisionCompanyClientSecret: true, TNID also returns a clientId and clientSecret for company-level API calls. See Create company profile.

Step B (alternative): generate company credentials later. Call Create Company Client Secret or use Client Secrets in the TNID app, then exchange client_id and client_secret at /auth/token for a company Bearer token. Use that token with /company. See Company Authentication.

Optional: update your company profile. Use the updateCompany mutation with your company token. See Update Company Profile.


3) Common first calls after setup

Find companies (to connect with, or to avoid duplicates): query companies by name, tax ID, email, telephone number or webpage on /company. See Search Companies.

Invite another company or request a B2B connection:

  • Invite by details (legal name plus a representative's email) with createB2bInvite. See Invite Company.
  • Or send a connection request by invitedCompanyId with createB2bConnectionRequest. See Send B2B Connection Request.

Search for people and see your consumer connections: use users and b2cConnections on /company. See Search People and B2C Features.

User-side spam reporting: as a user, call createSpamReport and spamReports on /user so your customers can report unwanted communications. See Spam Reporting Features.

Get notified instead of polling: register a company webhook so TNID calls you when connection requests, subscriptions and opt-outs change. See Webhooks.

Register for 10DLC: brands and campaigns are submitted through TNID. See 10DLC Brands.


4) Where to point your requests

Purpose Path
People GraphQL POST /user
Companies GraphQL POST /company
Request an OTP POST /auth/create-user-otp
Exchange OTP or client credentials for tokens POST /auth/token
Refresh tokens POST /auth/refresh-token

Prefix each path with the environment host, for example https://api.staging.v2.tnid.com/company.


5) Quick mental model

  1. Become a user (OTP, token, /user).
  2. Create your company as that user and mint company credentials.
  3. Act as the company (company token, /company) for B2B and B2C connections, subscriptions, profile updates, invites, webhooks and 10DLC.

Every query and mutation, including the ones this guide does not cover, is documented in the API Reference.