PhoneNumber

Phone numbers: a real number your agents answer and call from.

[pick] = noclick.PhoneNumber.available(country="US", area_code="415", limit=1)
number = noclick.PhoneNumber.buy(pick, max_monthly_usd=5)
number.answer_with(host)                              # inbound calls reach this agent
call = number.call("+14155550100", goal="Confirm Friday's 3pm booking.").wait()
print(call.text)                                      # the transcript, one turn per line

Numbers in the countries NoClick sells in (PhoneNumber.coverage()), each at its own price: billed monthly, and once when bought where its carrier charges that; available on accounts with the phone feature (noclick.NotAvailable otherwise). A number whose country asks for documents is bought with them (PhoneNumber.upload_document, then requirements= on buy): the carrier reviews them first, so buy returns a PhoneNumberOrder that becomes the number once the carrier approves it. A number you keep with your own phone provider is connected through that provider account (PhoneNumber.connect), which bills it. Numbers have names (PhoneNumber.from_name). The answering agent can transfer a call to a person, a caller proven to be one of your users runs as that user, callers says who gets through, calls both ways are listed, and a number can record its calls. Invite-only beta: the agent texting the caller (answer_with(texts=True), under a TextingRegistration of your business with the US carriers), porting numbers in (PhoneNumber.port_in) and moving one away (PhoneNumber.transfer_out).

class PhoneNumber

A number you own. release() gives it back (billing stops).

Attributes
idstring
namestring | null

What your code calls it (null for one bought without a name).

numberstring

The number in E.164 form.

sourcePhoneNumberSource | null

Where it came from: bought or connected (ported is in invite-only beta).

connectionstring | null

The phone provider connection a connected number runs through (its name; null otherwise).

agentIdstring | null

The agent that answers inbound calls (null if none).

transferTostring | null

Where the answering agent's transfer_call tool sends a call (null: no such tool).

textsboolean

Invite-only beta. Whether the answering agent can text the caller (send_text).

callersPhoneCallers | null

Who gets through: anyone, users or owner.

recordCallsboolean

Whether its calls, both ways, are recorded.

monthlyUsdnumber | null

What NoClick bills for it a month, in US dollars (null for a connected number, which its provider bills).

userIdstring | null
createdAtDate | null
releasedboolean

Whether release() gave the number back, or disconnect() handed it back to its provider account.

availablestatic

static available(
  options?: CallOptions & {
    country?: string;
    type?: PhoneNumberType;
    areaCode?: string | number;
    locality?: string;
    region?: string;
    contains?: string;
    startsWith?: string;
    endsWith?: string;
    features?: "voice" | "voice_sms";
    limit?: number;;
  },
): Promise<AvailableNumber[]>

Numbers for sale in country (US by default) of type (local by default), narrowed by areaCode, locality (a city), region, contains (digits, letters or * wildcards), startsWith and endsWith (digits of the national number), and features (voice, or voice_sms for numbers that take texts too). Each comes with its prices and what its country asks before it's sold.

Parameters
options.countrystring
options.typePhoneNumberType
options.areaCodestring | number
options.localitystring
options.regionstring
options.containsstring
options.startsWithstring
options.endsWithstring
options.features"voice" | "voice_sms"
options.limitnumber

Return at most this many.

options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

Up to limit numbers (10 by default, at most 30), each with its monthly_usd and upfront_usd, the locality and region it's local to, what it can do (capabilities), what its country asks before it's sold (requirements) and whether it can text (texting).

coveragestatic

static coverage(options?: CallOptions): Promise<NumberCoverage[]>

The countries numbers are for sale in, with the kinds of number sold in each. Right after a deploy, while that is still being found out, the API answers 503 with Retry-After, which the client retries on its own.

Parameters
options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

A noclick.NumberCoverage per country: its ISO code, the kinds of number in stock there (types), the kinds that can text (texting_types), the kinds bought with documents the carrier reviews first (documents_types) and the kinds that ask a step that can't be taken here (steps_types), which can't be bought through the API yet.

placesstatic

static places(
  country: string,
  options?: CallOptions & { type?: PhoneNumberType },
): Promise<NumberPlace[]>

Where in country numbers of type (local by default) are for sale: cities, or area codes in North America.

Parameters
countrystringrequired
options.typePhoneNumberType
options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

A noclick.NumberPlace per place: its kind (locality or area_code), its value and the region it's in. Empty where the carrier doesn't say.

buystatic

static buy(
  number: string | AvailableNumber,
  options: PhoneNumberBuyOptions & {
    address?: undefined;
    requirements?: undefined;
  },
): Promise<PhoneNumber>

Buy number; refused with PriceExceeded if it costs more than maxMonthlyUsd a month or maxUpfrontUsd once (by default, the upfrontUsd an AvailableNumber showed; 0 for a number passed as a string). A number whose country asks who holds it takes address, with a phone where a requirement's kind is contact. One whose country asks for documents takes requirements: each textual and document requirement's answer by its id (the text, or a NumberDocument from PhoneNumber.uploadDocument); it resolves to a PhoneNumberOrder in the carrier's review (days, sometimes), and nothing is charged until it completes. name is what your code calls it, unique among its user's numbers (a taken one is a Conflict with existingId, before anything is bought).

Parameters
numberstring | AvailableNumberrequired
options.maxMonthlyUsdnumberrequired
options.maxUpfrontUsdnumber
options.countrystring
options.typePhoneNumberType
options.addressNumberHolder
options.requirementsRecord<string, string | NumberDocument>
options.namestring
options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

The number, now yours. Its first month is charged now and it renews monthly until you release() it. A number whose country asks for documents comes back as a noclick.PhoneNumberOrder instead, in the carrier's review (days, sometimes): nothing is charged until it completes, and order.phone_number() is the number once it has.

uploadDocumentstatic

static uploadDocument(
  file: Uint8Array | ArrayBuffer | Blob,
  options: CallOptions & {
    requirement: string | NumberRequirement;
    country: string;
    type?: PhoneNumberType;
    filename: string;
  },
): Promise<NumberDocument>

Upload a document one of a number's requirements asks for (a requirement of kind document in country's numbers of type, local by default): a PDF, PNG or JPEG up to 20 MB. requirement is the requirement or its id. The carrier holds the file; NoClick keeps only its name and what it's for. Pass the result in requirements when you buy.

Parameters
fileUint8Array | ArrayBuffer | Blobrequired
options.requirementstring | NumberRequirementrequired
options.countrystringrequired
options.typePhoneNumberTypedefault "local"
options.filenamestringrequired
options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

A noclick.NumberDocument to pass in requirements when you buy. One no purchase names within 25 minutes is gone; one a purchase named can be named again.

connectablestatic

static connectable(
  connection: Connection | string,
  options?: CallOptions,
): Promise<ConnectableNumber[]>

The numbers (up to 1,000) in your phone provider account that connection (a Connection or its name, connected with the account's own credentials; one holding a restricted API key throws InvalidRequest naming connection) can route, each with its label, whether its calls go somewhere today and, when it's already connected to NoClick, its phoneNumberId and agentId.

Parameters
connectionConnection | stringrequired
options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

Each number (up to 1,000) with its label, whether its calls go somewhere today (routed_elsewhere), and, when it's already connected to NoClick, the number it's connected as (phone_number_id) and the agent answering it (agent_id).

connectstatic

static connect(
  number: string | ConnectableNumber,
  options: CallOptions & {
    connection: Connection | string;
    name?: string;
    recordCalls?: boolean;
  },
): Promise<PhoneNumber>

Connect number, which you keep with your own phone provider, through connection (its account, connected with the account's own credentials: NoClick checks the provider's signed calls with the account's secret, which a restricted key can't). NoClick remembers where its calls go today and leaves them there until answerWith routes them to an agent; disconnect() puts them back. The provider bills the number and its minutes; NoClick bills only what it adds (the agent's time on a call). Inside asUser it's the user's number on the user's connection. A number already connected, or one another NoClick workflow answers, throws Conflict; one on a SIP trunk, InvalidRequest.

Parameters
numberstring | ConnectableNumberrequired
options.connectionConnection | stringrequired
options.namestring
options.recordCallsboolean
options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

The number, source connected, with no agent yet.

portIninvite-only betastatic

static portIn(
  numbers: string | string[],
  options: PortInOptions,
): Promise<PortRequest>

Invite-only beta. Port US local numbers in from their carrier, so they become NoClick numbers: one, or several on one account at that carrier (one letter of authorization covers them). accountHolder signs the letter on a NoClick page, branded like your other pages; the rest is how the current carrier knows the account, as its bill shows it. Each number keeps working with its carrier until it moves; then it's a NoClick number, billed monthly like a bought one (PriceExceeded, nothing sent, above maxMonthlyUsd). A number you connected through your own phone provider is disconnected first (InvalidRequest otherwise); for one kept with Twilio, the account's name is "Twilio, Inc.", its number the last 8 characters of your Account SID, and the PIN comes from Twilio's support. Resolves to a PortRequest whose wait() gives the PhoneNumbers.

Parameters
numbersstring | string[]required
options.accountHolderHuman | stringrequired

The person authorized on the account, who signs the letter of authorization on a NoClick page: a Human with an email, or the email.

options.accountNamestringrequired

The name on the account, often a business, not the signer.

options.serviceAddressStreetAddressrequired
options.accountNumberstringrequired
options.maxMonthlyUsdnumberrequired

The most each may cost a month once it's yours, in US dollars; above it PriceExceeded, and nothing is sent.

options.billingNumberstring

The account's main number (the first number when omitted).

options.pinstring

The account's PIN, or a mobile account's transfer PIN, where the carrier has one.

options.billUint8Array

A recent bill from the current carrier (PDF bytes), which some carriers ask for.

options.namestring

What your code calls the number, when you port one.

options.requestedAtDate | string

When you'd like them to move; the carrier sets the dates, a few business days out at the earliest.

options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

The port request: an operation in awaiting_human until the account holder signs (sign_url), then submitted and scheduled (its step), whose .wait() gives the PhoneNumber objects once they've moved. They keep working with their carrier until then.

fromNamestatic

static fromName(
  name: string,
  options?: CallOptions & {
    createIfMissing?: boolean;
    areaCode?: string | number;
    maxMonthlyUsd?: number;
    maxUpfrontUsd?: number;
    connect?: string;
    connection?: Connection | string;
    recordCalls?: boolean;;
  },
): PhoneNumber

A lazy reference to the number called name for the current (or given) user. With createIfMissing your code is the definition: the first time it's used with none of that name, NoClick buys a US local number in areaCode (any US one when omitted) for at most maxMonthlyUsd a month and maxUpfrontUsd once, and names it, or with connect connects that number of yours through connection instead; an existing number whose recordCalls differs is updated.

Parameters
namestringrequired
options.createIfMissingboolean
options.areaCodestring | number
options.maxMonthlyUsdnumber
options.maxUpfrontUsdnumber
options.connectstring
options.connectionConnection | string
options.recordCallsbooleanomit to leave it unchanged
options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

A number that loads (or is bought, or brought in step with your definition) the first time it's used. Nothing is sent yet.

fromIdstatic

static fromId(numberId: string, options?: CallOptions): PhoneNumber

A lazy reference to a number you own, by id.

Parameters
numberIdstringrequired
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
Returns

A number that loads the first time you read a field. Nothing is sent yet.

getstatic

static get(numberId: string, options?: CallOptions): Promise<PhoneNumber>

Load a number by id now; an unknown id, or one you released, raises noclick.NotFound.

Parameters
numberIdstringrequired
options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

The number, loaded.

liststatic

static list(options?: ReadOptions & { limit?: number }): Promise<PhoneNumber[]>

The numbers you own (the current user's inside asUser, or those userFilter covers).

Parameters
options.limitnumber

Return at most this many.

options.userFilterUserFilter

Which users the read covers (user_id query), instead of acting as one (user).

options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

Every matching number, newest first, fetched page by page. Released numbers aren't listed.

listPagestatic

static listPage(options?: ReadOptions & PageOptions): Promise<Page<PhoneNumber>>

One page of numbers; pass nextCursor back as cursor.

Parameters
options.cursorstring | null

The next_cursor of the page before; omit it for the first page.

options.limitnumber

Return at most this many.

options.userFilterUserFilter

Which users the read covers (user_id query), instead of acting as one (user).

options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

A page whose data holds the numbers and whose next_cursor is None on the last page.

release

release(): Promise<void>

Give the number back; it stops ringing and billing. A connected number throws Conflict: disconnect() it.

disconnect

disconnect(): Promise<void>

Hand a connected number back to its provider account: NoClick takes it off its agent, puts back where its calls went before, and it leaves your list. A bought number throws Conflict: release() it.

update

update(changes: { name?: string | null; recordCalls?: boolean }): Promise<this>

Rename it (name: null removes its name; one another of its user's numbers has is a Conflict), or start or stop recording its calls from the next call (both sides in one file; the caller hears that the call is recorded before the agent speaks).

Parameters
changes{ name?: string | null; recordCalls?: boolean }required
Returns

This number, updated. A field you leave out is unchanged.

answerWith

answerWith(agent: Agent | string, options?: AnswerWithOptions): Promise<this>

Route inbound calls to agent, an agent on the sdk harness, whose tools and connections work during a call as in a message; one on a coding harness can't answer calls (NotAvailable). Calling it again replaces the whole setup: an option left out goes back to its default.

Parameters
agentAgent | stringrequired
options.transferTostring | Human

Gives the agent a transfer_call tool that hands the caller to this number (E.164) or Human with a phone, once the agent has said so; who picks up hears why first, and a transfer nobody picks up comes back to the agent, which is told.

options.textsbooleaninvite-only beta

Invite-only beta. Gives the agent a send_text tool that texts the caller, and only the caller (a link, a confirmation, an address), after asking and hearing a yes. Each text is signed with your brand (Harbor Dental: ...), the first to a caller says how to opt out, and a caller who texted STOP is never texted again. Texting from a US number needs your business registered with the US carriers (TextingRegistration); until that's approved this throws ActionRequired naming it, and a number that can't text (one kept with your own phone provider) throws NotAvailable. Until texting ships it throws NotAvailable.

options.callersPhoneCallers

Who gets through: anyone (the default), users (only a caller whose number is a user's verified phone, attested by the carrier) or owner (only the number's own user, or your account's owner). On an account number such a user's call runs as them under every setting; a user's own number runs every call as that user.

(default "anyone")
options.conversationstring

The agent's conversation each call lands in, a template over {caller} and {number}: "owner" puts every call in the same conversation as agent.message(..., { conversation: "owner" }). Omitted, each caller has a conversation of their own on the number.

Returns

This number, with agent_id naming the agent that now answers it.

call

call(
  to: string,
  options: { goal: string; agent?: Agent | string },
): Promise<Operation<PhoneCall>>

Call to with the number's answering agent working toward goal (agent, if given, must be that agent). wait() resolves to the PhoneCall with its transcript at hang-up.

Parameters
tostringrequired
options.goalstringrequired
options.agentAgent | string
Returns

An operation whose .wait() gives the PhoneCall at hang-up, with its transcript, status (completed or not_connected), length and cost.

calls

calls(
  options?: {
    direction?: "inbound" | "outbound";
    since?: Date | string;
    limit?: number;
  },
): Promise<PhoneCall[]>

The calls on this number, newest first: the calls it answered with the ones it placed. direction keeps one kind, since those that started at or after it, and limit the newest that many.

Parameters
options.direction"inbound" | "outbound"
options.sinceDate | string
options.limitnumber

Return at most this many.

Returns

The matching calls, each with its direction and its transcript once it has ended (and recording_url when the number records its calls).

textMessagesinvite-only beta

textMessages(
  options?: {
    direction?: "inbound" | "outbound";
    since?: Date | string;
    limit?: number;
  },
): Promise<PhoneText[]>

Invite-only beta. The texts its answering agent sent callers (send_text) and the texts the number received, newest first. A reply doesn't wake the agent: read it here, or take phone.text.received events. direction keeps one kind, since those at or after it.

Parameters
options.direction"inbound" | "outbound"
options.sinceDate | string
options.limitnumber

Return at most this many.

Returns

The matching texts, each with its direction, text, status and cost.

transferOutinvite-only beta

transferOut(): Promise<TransferOut>

Invite-only beta. Move the number to another carrier: what that carrier asks for (the account it's on and a transfer PIN for it). Another carrier may take the number for 30 days from now; a request outside that window, or quoting another PIN, is refused, so nobody takes it without you. Once it moves, it leaves your numbers and its billing stops.

Returns

The transfer's details, with its pin and expires_at.

AvailableNumber

interface AvailableNumber

A number you can buy: PhoneNumber.buy(available, { maxMonthlyUsd }). monthlyUsd it costs a month and upfrontUsd once, when it's bought. texting: registration (a US number, which texts under your business's US carrier registration), unavailable (texting from its country isn't available yet) or none (it can't text).

Attributes
numberstring
monthlyUsdnumber | null
localitystring | null
regionstring | null
rawJsonObject

The response JSON exactly as the API sent it.

countrystring
typePhoneNumberType
upfrontUsdnumber | null
capabilitiesstring[]
requirementsNumberRequirements
texting"registration" | "unavailable" | "none"

PhoneCall

interface PhoneCall

One call on a number, answered (direction inbound) or placed (outbound). transcript is filled in at hang-up; text reads it as lines.

Attributes
idstring | null
directionstring | null
tostring | null
fromNumberstring | null
statusstring | null

calling while it runs; ends completed, not_connected, refused (turned away by callers), failed or lost.

goalstring | null
agentIdstring | null
transcriptTranscriptTurn[]
secondsnumber | null
costUsdnumber | null

What the call was charged, as your usage shows it (null until it has ended and its charge is recorded, or when it never connected).

errorstring | null
createdAtDate | null
endedAtDate | null
userIdstring | null

The user the call ran as: on an account number, a caller proven to be one of your users (their verified phone, attested by the carrier), whatever the number's callers; on a user's number, its user.

recordingUrlstring | null

A signed link to the recording (both sides, one file), valid for an hour from when you read the call; null unless the number records its calls, or once the recording is deleted.

transfer{ to: string; status: string; seconds?: number } | null

Where the agent handed the caller (to) and whether they picked up (status, seconds); null if nobody was.

rawJsonObject

The response JSON exactly as the API sent it.

textstring

The transcript as role: text lines.

ConnectableNumber

interface ConnectableNumber

A number in your phone provider account, from PhoneNumber.connectable: connect it with PhoneNumber.connect(connectable, { connection }).

Attributes
numberstring
labelstring | null

The provider account's own name for it.

routedElsewhereboolean

Its calls go somewhere today (a URL, an application, a SIP trunk): answering it takes them over, and disconnect() puts that back.

phoneNumberIdstring | null

The NoClick number it's already connected as (null when it isn't); connecting it again throws Conflict.

agentIdstring | null

The agent answering it, when it's already connected (null otherwise).

rawJsonObject

The response JSON exactly as the API sent it.

PortRequestinvite-only beta

class PortRequest extends Operation

Invite-only beta. Numbers moving to NoClick from their carrier on one letter of authorization: the operation PhoneNumber.portIn returns. It waits in awaiting_human until the account holder signs the letter at signUrl, then runs (step submitted, then scheduled once the carrier has given every number its date, portAt the latest) and resolves to the PhoneNumbers (source ported) once they've moved. A rejection fails it with the carrier's reason: InvalidRequest whose field names what didn't match its records (account_name, account_holder, service_address, account_number, billing_number, pin, numbers or requested_at); retry sends corrected details. cancel() works until the carrier has committed to a date. The numbers keep working with their carrier until they move.

Attributes
numberstring | null

The first number on the letter, in E.164 form.

numbersPortRequestNumber[]

Each number on the letter, with its own status and portAt: a carrier can move them on different days.

portAtDate | null

When the last number moves, once every one is scheduled.

monthlyUsdnumber | null

What each number costs a month once it's yours, in US dollars.

signUrlstring | null

While awaiting_human: the page where the account holder signs (it's emailed to them too).

liststatic

static list(
  options?: KindScopedFilters & { limit?: number },
): Promise<PortRequest[]>

Port requests (kind phone.port_in), newest first; takes Operation.list's filters except kind.

Parameters
options.limitnumber

Return at most this many.

options.clientNoClick
options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

options.statusOperationStatus | "live" | readonly (OperationStatus | "live")[]

Statuses, or "live" for every non-terminal one.

options.agentstring | ApiObject

An Agent or agent id.

options.statusNotOperationStatus | readonly OperationStatus[]
options.keystring

The requesting key: its id or its prefix (nk_live_ab12).

options.createdAfterDate | string
options.createdBeforeDate | string
options.updatedAfterDate | string

Rows changed since (for polling).

options.userFilterUserFilter

Which users the read covers (user_id query), instead of acting as one (user).

Returns

Every matching port request (or the first limit), each with its numbers, step, port_at and sign_url.

listPagestatic

static listPage(
  options?: KindScopedFilters & PageOptions,
): Promise<Page<PortRequest>>

One page of port requests; pass nextCursor back as cursor.

Parameters
options.cursorstring | null

The next_cursor of the page before; omit it for the first page.

options.limitnumber

Return at most this many.

options.clientNoClick
options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

options.statusOperationStatus | "live" | readonly (OperationStatus | "live")[]

Statuses, or "live" for every non-terminal one.

options.agentstring | ApiObject

An Agent or agent id.

options.statusNotOperationStatus | readonly OperationStatus[]
options.keystring

The requesting key: its id or its prefix (nk_live_ab12).

options.createdAfterDate | string
options.createdBeforeDate | string
options.updatedAfterDate | string

Rows changed since (for polling).

options.userFilterUserFilter

Which users the read covers (user_id query), instead of acting as one (user).

Returns

A page whose data holds the port requests and whose next_cursor is None on the last page.

retry

retry(corrections?: Partial<PortDetails>): Promise<PortRequest>

Send a port the carrier refused again with corrected details, for the numbers that haven't moved; a detail you leave out keeps what it had. A change to what the letter says (the account holder, the account's name, the service address, the account or billing number), or a refusal of the name it was signed with, asks the account holder to sign again; a new pin, bill or requestedAt goes straight back. Resolves to a new PortRequest for the same numbers.

Parameters
correctionsPartial<PortDetails>
Returns

A new port request for the same numbers, waiting as port_in's does.

portFromIdstaticTypeScript only

static portFromId(operationId: string, options?: CallOptions): PortRequest

A lazy reference to a port by operation id: resume it anywhere (Operation.fromId gives a plain operation).

Parameters
operationIdstringrequired
options.clientNoClick
options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

TextingRegistrationinvite-only beta

class TextingRegistration

Invite-only beta. Your business registered with the US carriers, which texting from a US number needs: the brand the carriers' registry verifies, and the campaign NoClick writes for it (a voice agent texting a caller one thing they asked for, after a spoken yes). One per scope: your account's, or one of your users' (a user's own number texts under its user's registration when there is one, else the account's). Review takes days to weeks; status follows it: pending, awaiting_human (its contact must answer the registry: a public company's verification email, or a sole proprietor's texted code, sent back with verify), in_review, then approved, rejected (statusReason, and fields names the facts to correct with update) or suspended. delete() stops texting and its monthly fee.

Attributes
idstring
statusstring | null

pending, awaiting_human, in_review, approved, rejected or suspended.

statusReasonstring | null

The reviewer's words, when it refused or suspended it.

fieldsstring[]

The facts a refusal named, to correct with update.

legalNamestring | null
brandNamestring | null

What its texts are signed with: Harbor Dental: ....

entityTypestring | null
industrystring | null
websitestring | null
taxIdstring | null

The EIN, its last four digits shown.

privacyUrlstring | null
termsUrlstring | null
setupUsdnumber | null

Charged once, as the registry charges it: the brand when registered, the campaign's review and first months when it opens.

monthlyUsdnumber | null

The campaign's monthly fee, after its first months.

segmentUsdnumber | null

What a text costs a segment (160 characters), sent or received, before the recipient's network fee, which is charged as reported.

userIdstring | null
approvedAtDate | null
createdAtDate | null

createstatic

static create(
  options: TextingRegistrationDetails & CallOptions,
): Promise<TextingRegistration>

Register the business with the US carriers, as the legal entity on its tax records. Resolves to the registration, pending; its brand's fee is charged now. A scope that has one throws Conflict with its existingId.

Parameters
options.legalNamestringrequired

The legal entity as its tax records name it.

options.entityType"private_company" | "public_company" | "nonprofit" | "government" | "sole_proprietor"required
options.industrystringrequired

One of the registry's (healthcare, retail, professional, ...).

options.addressStreetAddressrequired

Its US address.

options.websitestringrequired

website, privacyUrl and termsUrl are pages anyone can open; the privacy policy must say phone numbers aren't shared.

options.contactTextingContactrequired
options.privacyUrlstringrequired
options.termsUrlstringrequired
options.maxSetupUsdnumberrequired

Refused (PriceExceeded, nothing registered) above this once, in US dollars.

options.maxMonthlyUsdnumberrequired

Refused (PriceExceeded, nothing registered) above this a month, in US dollars.

options.taxIdstring

Its EIN (none for a sole proprietor).

options.brandNamestring

What texts are signed with (the legal name when omitted).

options.stock{ symbol: string; exchange: string }

A public company's listing.

options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

The registration, pending; its brand's fee is charged now. A scope that has one raises noclick.Conflict with its existing_id.

fromIdstatic

static fromId(
  registrationId: string,
  options?: CallOptions,
): TextingRegistration

A lazy reference to a registration by id.

Parameters
registrationIdstringrequired
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
Returns

A registration that loads the first time you read a field. Nothing is sent yet.

getstatic

static get(
  registrationId: string,
  options?: CallOptions,
): Promise<TextingRegistration>

Load a registration by id now; an unknown or deleted one throws NotFound.

Parameters
registrationIdstringrequired
options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

The registration, loaded.

liststatic

static list(
  options?: ReadOptions & { limit?: number },
): Promise<TextingRegistration[]>

The registrations of the current user (or, without one, the account's), or those userFilter covers, newest first.

Parameters
options.limitnumber

Return at most this many.

options.userFilterUserFilter

Which users the read covers (user_id query), instead of acting as one (user).

options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

Every matching registration, newest first. Deleted ones aren't listed.

update

update(corrections: Partial<TextingRegistrationDetails>): Promise<this>

Resubmit a refused registration (or one waiting on its contact) with corrected facts; a fact you leave out keeps what it had. A corrected privacyUrl or termsUrl opens a new campaign, whose review and first months are charged again. Resolves to this registration, back in review.

Parameters
correctionsPartial<TextingRegistrationDetails>required
Returns

This registration, back in review.

verify

verify(code: string): Promise<this>

A sole proprietor's contact sends back the code the registry texted them (InvalidRequest naming code when it's wrong or expired).

Parameters
codestringrequired
Returns

This registration, its contact verified.

delete

delete(): Promise<void>

Stop texting under it: its numbers stop texting, its campaign closes and its monthly fee ends.

PhoneTextinvite-only beta

interface PhoneText

Invite-only beta. A text a number's agent sent a caller (direction outbound) or one the number received (inbound).

Attributes
idstring | null
directionstring | null
fromNumberstring | null
tostring | null
textstring | null
keywordstring | null

stop, start or help when a received text was one: STOP stops texts to its sender, START lets them through again, and both are answered in your business's name.

statusstring | null

sent, then delivered or failed, for one sent; received for one received.

segmentsnumber | null
costUsdnumber | null

What it was charged: its segments, and the recipient's network fee once it's reported.

callIdstring | null
errorstring | null
createdAtDate | null
rawJsonObject

The response JSON exactly as the API sent it.

TransferOutinvite-only beta

class TransferOut

Invite-only beta. What the carrier you're moving a number to asks for, from number.transferOut(): the account the number is on as NoClick's carrier's records show it, and a transfer pin for this number, good until expiresAt. Until then another carrier may take the number; after it, a request is refused. Printing it never shows the PIN.

Attributes
phoneNumberIdstring | null
numberstring | null
accountNamestring | null
accountNumberstring | null
pinstring | null
serviceAddressstring | null
expiresAtDate | null
rawJsonObject

The response JSON exactly as the API sent it.

NumberHolder

interface NumberHolder

Who a number is registered to, for a country that asks who holds it (a requirement's kind is address or contact).

Attributes
namestring

First and last name.

streetstring
citystring
postalCodestring
countrystring

ISO alpha-2.

businessNamestring
street2string
regionstring

State, province or county, where the country has one.

phonestring

A number to contact them on, in E.164; required where one of the requirements' kind is contact.

NumberCoverage

interface NumberCoverage

A country numbers are for sale in, the kinds in stock there, the kinds that can text, the kinds bought with documents the carrier reviews first (documentsTypes) and the kinds that ask a step that can't be taken here (stepsTypes: these can't be bought through the API yet).

Attributes
countrystring
typesPhoneNumberType[]
textingTypesPhoneNumberType[]
documentsTypesPhoneNumberType[]
stepsTypesPhoneNumberType[]

NumberPlace

interface NumberPlace

A place numbers of a kind are for sale in: a city, or an area code in North America.

Attributes
kind"locality" | "area_code"
valuestring
regionstring

NumberDocument

interface NumberDocument

A document you uploaded for one of a number's requirements (PhoneNumber.uploadDocument): pass it, or its id, in requirements when you buy. The carrier holds the file; NoClick keeps its name and what it's for. One no purchase names within 25 minutes is gone; one a purchase named can be named again.

Attributes
idstring
requirementIdstring
requirementNamestring
filenamestring
uploadedAtDate | null
rawJsonObject

The response JSON exactly as the API sent it.

PhoneNumberOrder

class PhoneNumberOrder

A number ordered while the carrier reviews the documents filed for it (PhoneNumber.buy of a number whose country asks for them). Nothing is yours, or charged, until it completes: status is in_review, rejected (the carrier sent it back: reason says why; resubmit corrections before deadline), completed (phoneNumber() is the number) or failed (it ended without the number; nothing was charged).

Attributes
idstring
numberstring

The number ordered, in E.164 form.

countrystring | null
typePhoneNumberType | null
status"in_review" | "rejected" | "completed" | "failed"

in_review, rejected, completed or failed.

reasonstring | null

The carrier's words when it sent the order back or ended it (null otherwise).

deadlineDate | null

When a sent-back order must be corrected by.

monthlyUsdnumber | null

What the number costs a month, once it's yours.

upfrontUsdnumber | null

What it costs once, charged when the order completes.

phoneNumberIdstring | null

The number, once the order completed.

requirementsNumberRequirements | null

While it's open: what its country asks, which a resubmit answers.

createdAtDate | null
updatedAtDate | null

retrievestatic

static retrieve(
  orderId: string,
  options?: CallOptions,
): Promise<PhoneNumberOrder>

Load an order by id now; an unknown id throws NotFound.

Parameters
orderIdstringrequired
options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

The order, as it stands.

resubmit

resubmit(
  options?: {
    address?: NumberHolder;
    requirements?: Record<string, string | NumberDocument>;
  },
): Promise<this>

File corrected answers for an order the carrier sent back (status rejected), for its review again: address and requirements as PhoneNumber.buy takes them. Any other order throws Conflict.

Parameters
options.addressNumberHolder
options.requirementsRecord<string, string | NumberDocument>
Returns

This order, in_review again.

phoneNumber

phoneNumber(): Promise<PhoneNumber>

The number, once the order completed; Conflict while it hasn't (refresh() first).

Returns

The noclick.PhoneNumber the order became.