Skip to main content

B2B Registration API

POST /api/b2b/register

Creates a new B2B workspace for an organization. The response includes the first API key once, so the caller must store it immediately.

warning

The clientSecret is returned only in the registration response. GOFA cannot display the same secret again later. Create a new key if the original value is lost.

Request Body:

FieldTypeRequiredNotes
clientIdstringYesLowercase letters, numbers, and hyphens. This becomes the client identifier used in API authentication.
clientNamestringYesDisplay name for the organization.
ownerNamestringYesDisplay name for the initial workspace owner.
emailstringYesWork email for the owner account.
passwordstringYesMinimum 8 characters.
primaryColorstringNoOptional 6-digit hex color such as #ef8173.
termsAcceptedbooleanYesMust be true.

Sample Request:

Request Body
{
"clientId": "acme-wellness",
"clientName": "Acme Wellness",
"ownerName": "Alex Chan",
"email": "admin@acme.example",
"password": "a-secure-password",
"primaryColor": "#ef8173",
"termsAccepted": true
}

Sample Response:

201-style Success Response
{
"success": true,
"clientId": "acme-wellness",
"clientName": "Acme Wellness",
"clientSecret": "generated-api-key-value",
"initialApiPlanDefinitionId": "free_plan",
"initialApiPlanName": "Free Plan",
"portalUrl": "https://acme-wellness.gofa.app/b2b/login"
}

Responses:

  • 200 OK: Workspace created and initial API key returned.
  • 400 Bad Request: Invalid request body or reserved client ID.
  • 409 Conflict: Client ID or owner email already exists.
  • 500 Internal Server Error: Registration could not be completed.

After registration, sign in through the returned portalUrl using the owner email and password.