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
Organization profile information Official registered legal name of the organization
Tax identification number (EIN, VAT, RFC, etc.)
Date of incorporation or registration Format: YYYY-MM-DD Example: "2020-01-15"
Business legal structure type Examples: "LLC", "Corporation", "Partnership", "Sole Proprietorship"
incorporation_country_code
ISO country code where the organization is incorporated Examples: "US", "GB", "CA"
State or province of incorporation Example: "DE" (Delaware), "CA" (California)
Primary business address (street address)
Secondary address line (suite, floor, etc.)
City where organization is registered
URL to organization’s logo image Example: "https://example.com/logo.png"
Additional business locations or offices ISO country code for the location
Whether this is the primary business location
Additional custom metadata for the organization You can store any additional information relevant to your application. Example: {
"industry" : "Technology" ,
"employee_count" : 50 ,
"website" : "https://example.com"
}
Returns
Unique resource name (URN) identifying the organization Example: "urn:bloque:org:abc123"
org_type
'business' | 'individual'
required
Type of organization
Current status of the organization Possible values:
"awaiting_compliance_verification" - Pending compliance review
"active" - Fully verified and operational
"suspended" - Temporarily suspended
"closed" - Permanently closed
Complete organization profile (matches input structure)
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
Created : Organization is created with awaiting_compliance_verification status
Compliance Review : Bloque reviews the organization information
Active : Once approved, status changes to active and full features are enabled
Suspended : May be temporarily suspended for compliance issues
Closed : Permanently closed organizations cannot be reactivated