Skip to Content
Wirebird Docs

Create a session

POST /v1/embed/sessions. Server to server, with your secret key.

POST https://api.getwirebird.com/v1/embed/sessions
Authorization: Bearer wb_live_…
Content-Type: application/json

Finds or creates the business and business user by your IDs, then returns a session token scoped to exactly them, valid for one hour. Call it from your server only; it doesn't accept browser requests.

Request body

{
  "business": {
    "externalId": "company_8812",
    "name": "Harbor Tile & Floor",
    "timezone": "America/Chicago"
  },
  "businessUser": {
    "externalId": "user_51",
    "name": "Sam Ortiz",
    "email": "sam@harbortile.example",
    "role": "owner"
  },
  "components": ["setup", "inbox"]
}

business

FieldTypeRequiredDescription
externalIdstring, 1–200 charsYesYour id for the business. Keep it stable.
namestring, 1–200 charsYesUsed when the business is created.
timezoneIANA time zoneNoUsed when the business is created. Default America/New_York.
profileobjectNoPre-fill for the setup form.

businessUser

FieldTypeRequiredDescription
externalIdstring, 1–200 charsYesYour id for the user.
rolestring, 1–100 charsYesTheir role in your product, as you name it (owner, staff…).
namestringNoShown on texts they send and calls they make.
emailemailNo

The user's name, email and role are updated on every call.

components

Optional. A non-empty list of the parts of Wirebird this session may use: setup, inbox, conversation, call_bar, call_settings, call_log, unread_badge. Leave it out to allow all of them.

Unknown fields are ignored.

Response

201 Created

{
  "data": {
    "token": "wbes_…",
    "expiresAt": "2026-12-03T18:04:11.000Z"
  }
}

Return data to your browser code as-is: it's what fetchToken resolves to. The token is shown only once; Wirebird stores just a hash of it.

Errors

Every error uses the same envelope:

{ "data": null, "error": { "code": "invalid_input", "message": "The request is invalid." } }
StatuscodeWhen
400invalid_inputThe body is missing a required field or a value is malformed. May include issues with the field.
401unauthenticatedMissing, malformed or revoked API key, or a test key against production (or the reverse).
404not_foundThe business or user was closed in Wirebird.
413The body is over 64 KB.
503retryableA temporary problem. Safe to retry with backoff.
500unexpectedSomething went wrong on our side. Safe to retry.

Pre-filling business details

If your product already knows a business's legal details, send them as business.profile and the setup form starts filled in. Every field is optional. Pre-fill only fills empty fields: anything the business already entered is kept.

{
  "business": {
    "externalId": "company_8812",
    "name": "Harbor Tile & Floor",
    "profile": {
      "legalName": "Harbor Tile & Floor LLC",
      "entityType": "PRIVATE_PROFIT",
      "ein": "12-3456789",
      "street": "120 Market St",
      "city": "Austin",
      "state": "TX",
      "postalCode": "78701",
      "phoneE164": "+15125550100",
      "website": "https://harbortile.example",
      "contactFirstName": "Sam",
      "contactLastName": "Ortiz",
      "contactEmail": "sam@harbortile.example"
    }
  },
  "businessUser": { "externalId": "user_51", "role": "owner" }
}
FieldNotes
legalName, dbaNameLegal name and "doing business as" name.
entityTypePRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT or GOVERNMENT.
ein12-3456789. Write-only: it's never returned, and the setup form shows only the last four digits.
street, street2, city, state, postalCodestate is the two-letter code.
phoneE164, websiteBusiness phone with country code; website starting with https://.
contactFirstName, contactLastName, contactEmail, contactPhoneE164The person carriers may contact about registration.
stockSymbol, stockExchangePublic companies only.
verificationEmailWhere the brand verification email goes, if a carrier sends one. Defaults to contactEmail.
verticalThe business's industry, from the list the setup form offers.
about, servicesPhrase, helpEmail, helpPhoneE164Shown on the business's public texting page.

Only send the EIN from your server; it's one more reason this endpoint never runs in a browser.

On this page