Skip to main content

Overview

The OrgsClient manages organizational entities within the Bloque platform. Organizations can represent businesses or individual entities with full profile information and compliance status.
import { SDK } from '@bloque/sdk';

const bloque = new SDK({
  origin: 'your-origin',
  auth: {
    type: 'apiKey',
    apiKey: 'your-api-key'
  },
  mode: 'production'
});

const session = await bloque.connect('user@example.com');
const orgs = session.orgs;

Methods

create()

Create a new organization with complete profile information. Organizations go through a compliance verification process before becoming fully active.
const org = await bloque.orgs.create({
  org_type: 'business',
  profile: {
    legal_name: 'Acme Corporation',
    tax_id: '12-3456789',
    incorporation_date: '2020-01-15',
    business_type: 'LLC',
    incorporation_country_code: 'US',
    incorporation_state: 'DE',
    address_line1: '123 Business St',
    postal_code: '10001',
    city: 'New York'
  },
  metadata: {
    industry: 'Technology',
    employee_count: 50
  }
});

console.log(org.urn); // Organization URN
console.log(org.status); // "awaiting_compliance_verification"

Parameters

org_type
'business' | 'individual'
required
Type of organization being created
  • "business" - Corporate entity or business
  • "individual" - Individual person operating as an organization
profile
object
required
Organization profile information
metadata
Record<string, unknown>
Additional custom metadata for the organizationYou can store any additional information relevant to your application.Example:
{
  "industry": "Technology",
  "employee_count": 50,
  "website": "https://example.com"
}

Returns

urn
string
required
Unique resource name (URN) identifying the organizationExample: "urn:bloque:org:abc123"
org_type
'business' | 'individual'
required
Type of organization
status
string
required
Current status of the organizationPossible values:
  • "awaiting_compliance_verification" - Pending compliance review
  • "active" - Fully verified and operational
  • "suspended" - Temporarily suspended
  • "closed" - Permanently closed
profile
object
required
Complete organization profile (matches input structure)
metadata
Record<string, unknown>
Custom metadata associated with the organization

Example Response

{
  "urn": "urn:bloque:org:abc123def456",
  "org_type": "business",
  "status": "awaiting_compliance_verification",
  "profile": {
    "legal_name": "Acme Corporation",
    "tax_id": "12-3456789",
    "incorporation_date": "2020-01-15",
    "business_type": "LLC",
    "incorporation_country_code": "US",
    "incorporation_state": "DE",
    "address_line1": "123 Business St",
    "address_line2": "Suite 100",
    "postal_code": "10001",
    "city": "New York",
    "logo_url": "https://example.com/logo.png",
    "places": [
      {
        "country_code": "US",
        "state": "CA",
        "address_line1": "456 Tech Ave",
        "postal_code": "94105",
        "city": "San Francisco",
        "is_primary": false
      }
    ]
  },
  "metadata": {
    "industry": "Technology",
    "employee_count": 50
  }
}

Complete Organization Setup

1. Create Organization

const organization = await bloque.orgs.create({
  org_type: 'business',
  profile: {
    legal_name: 'TechCorp Inc.',
    tax_id: '98-7654321',
    incorporation_date: '2021-03-01',
    business_type: 'Corporation',
    incorporation_country_code: 'US',
    incorporation_state: 'CA',
    address_line1: '789 Innovation Dr',
    address_line2: 'Building 2',
    postal_code: '94025',
    city: 'Menlo Park',
    logo_url: 'https://techcorp.example/logo.png',
    places: [
      {
        country_code: 'US',
        state: 'TX',
        address_line1: '321 Austin St',
        postal_code: '78701',
        city: 'Austin',
        is_primary: false
      }
    ]
  },
  metadata: {
    industry: 'Software',
    founded_year: 2021,
    website: 'https://techcorp.example'
  }
});

console.log(`Organization created: ${organization.urn}`);
console.log(`Status: ${organization.status}`);

2. Individual Organization

const individualOrg = await bloque.orgs.create({
  org_type: 'individual',
  profile: {
    legal_name: 'Jane Smith',
    tax_id: '123-45-6789',
    incorporation_date: '2023-01-01',
    business_type: 'Sole Proprietorship',
    incorporation_country_code: 'US',
    address_line1: '123 Main St',
    postal_code: '10001',
    city: 'New York'
  }
});

Error Handling

try {
  const org = await bloque.orgs.create({
    org_type: 'business',
    profile: {
      legal_name: 'My Company',
      tax_id: '12-3456789',
      incorporation_date: '2020-01-15',
      business_type: 'LLC',
      incorporation_country_code: 'US',
      address_line1: '123 Business St',
      postal_code: '10001',
      city: 'New York'
    }
  });
} catch (error) {
  if (error instanceof BloqueValidationError) {
    console.error('Invalid organization data:', error.message);
  } else if (error instanceof BloqueAuthenticationError) {
    console.error('Authentication failed');
  } else {
    console.error('Unexpected error:', error);
  }
}

Organization Lifecycle

  1. Created: Organization is created with awaiting_compliance_verification status
  2. Compliance Review: Bloque reviews the organization information
  3. Active: Once approved, status changes to active and full features are enabled
  4. Suspended: May be temporarily suspended for compliance issues
  5. Closed: Permanently closed organizations cannot be reactivated

Build docs developers (and LLMs) love