export type CreateApiLegalEntitiesArgs = {body: {legal_entity_type: 'individual', status?: 'draft' | undefined, prefix?: string | undefined, first_name: string, middle_name?: string | undefined, last_name: string, suffix?: string | undefined, preferred_name?: string | undefined, citizenship_country?: string | undefined, date_of_birth: string, identifications: Array<{id_number: string, id_type: string, issuing_country?: string | undefined, issuing_region?: string | undefined, expiration_date?: string | undefined, documents?: (Array<{document_type?: ('ein_letter' | 'identification_front' | 'identification_back') | undefined, file_data: string, filename: string}>) | undefined}>, phone_numbers: Array<{phone_number?: string | undefined}>, wealth_and_employment_details?: ({employment_status?: ('"employed"' | '"retired"' | '"self_employed"' | '"student"' | '"unemployed"') | undefined, occupation?: ('"consulting"' | '"executive"' | '"finance_accounting"' | '"food_services"' | '"government"' | '"healthcare"' | '"legal_services"' | '"manufacturing"' | '"other"' | '"sales"' | '"science_engineering"' | '"technology"') | undefined, industry?: ('"accounting"' | '"agriculture"' | '"automotive"' | '"chemical_manufacturing"' | '"construction"' | '"educational_medical"' | '"food_service"' | '"finance"' | '"gasoline"' | '"health_stores"' | '"laundry"' | '"maintenance"' | '"manufacturing"' | '"merchant_wholesale"' | '"mining"' | '"performing_arts"' | '"professional_non_legal"' | '"public_administration"' | '"publishing"' | '"real_estate"' | '"recreation_gambling"' | '"religious_charity"' | '"rental_services"' | '"retail_clothing"' | '"retail_electronics"' | '"retail_food"' | '"retail_furnishing"' | '"retail_home"' | '"retail_non_store"' | '"retail_sporting"' | '"transportation"' | '"travel"' | '"utilities"') | undefined, income_source?: ('"family_support"' | '"government_benefits"' | '"inheritance"' | '"investments"' | '"rental_income"' | '"retirement"' | '"salary"' | '"self_employed"') | undefined, income_state?: string | undefined, income_country?: string | undefined, employer_name?: string | undefined, employer_state?: string | undefined, employer_country?: string | undefined, source_of_funds?: ('"alimony"' | '"annuity"' | '"business_owner"' | '"general_employee"' | '"government_benefits"' | '"homemaker"' | '"inheritance_gift"' | '"investment"' | '"legal_settlement"' | '"lottery"' | '"real_estate"' | '"retired"' | '"retirement"' | '"salary"' | '"self_employed"' | '"senior_executive"' | '"trust_income"' | 'business_revenue' | 'debt_financing' | 'intercompany_loan' | 'investor_funding' | 'retained_earnings_or_savings' | 'sale_of_business_assets' | 'sale_of_real_estate') | undefined, wealth_source?: ('"business_sale"' | '"family_support"' | '"government_benefits"' | '"inheritance"' | '"investments"' | '"other"' | '"rental_income"' | '"retirement"' | '"salary"' | '"self_employed"') | undefined, annual_income?: number | undefined}) | undefined, email: string, addresses: Array<{address_types?: Array | undefined, line1: string, line2?: string | undefined, locality: string, region?: string | undefined, postal_code?: string | undefined, country: string, primary?: boolean | undefined}>, website?: string | undefined, primary_social_media_sites?: Array | undefined, metadata?: unknown | undefined, intended_use?: string | undefined, expected_activity_volume?: number | undefined, external_id?: string | undefined, documents?: (Array<{document_type: 'articles_of_incorporation' | 'generic' | 'certificate_of_good_standing' | 'proof_of_address', file_data: string, filename: string}>) | undefined, service_provider_legal_entity_id?: (string | null) | undefined, terms_of_use?: ({accepted_at: string, ip_address: string} | null) | undefined} | {legal_entity_type: 'business', status?: 'draft' | undefined, business_name: string, date_formed: string, doing_business_as_names?: Array | undefined, legal_structure: 'corporation' | 'llc' | 'non_profit' | 'partnership' | 'sole_proprietorship' | 'trust', identifications: Array<{id_number: string, id_type: string, issuing_country?: string | undefined, issuing_region?: string | undefined, expiration_date?: string | undefined, documents?: (Array<{document_type: 'ein_letter' | 'identification_front' | 'identification_back', file_data: string, filename: string}>) | undefined}>, phone_numbers?: (Array<{phone_number?: string | undefined}>) | undefined, wealth_and_employment_details?: ({source_of_funds?: ('legal_settlement' | 'real_estate' | 'trust_income' | 'business_revenue' | 'debt_financing' | 'intercompany_loan' | 'investor_funding' | 'reatained_earnings_or_savings' | 'sale_of_business_assets' | 'sale_of_real_estate') | undefined, wealth_source?: ('business_sale' | 'family_support' | 'government_benefits' | 'inheritance' | 'investments' | 'other' | 'rental_income' | 'retirement' | 'salary' | 'self_employed') | undefined}) | undefined, email?: string | undefined, addresses: Array<{address_types: 'business' | 'business_registered', line1: string, line2?: string | undefined, locality: string, region?: string | undefined, postal_code?: string | undefined, country: string, primary?: boolean | undefined}>, website?: string | undefined, primary_social_media_sites?: Array | undefined, metadata?: unknown | undefined, legal_entity_associations?: (Array<{relationship_types: Array, title?: string | undefined, ownership_percentage?: string | undefined, child_legal_entity?: ({legal_entity_type: 'individual', prefix?: string | undefined, first_name: string, middle_name?: string | undefined, last_name: string, suffix?: string | undefined, preferred_name?: string | undefined, citizenship_country?: string | undefined, date_of_birth: string, identifications: Array<{id_number: string, id_type: string, issuing_country?: string | undefined, issuing_region?: string | undefined, expiration_date?: string | undefined, documents?: ({document_type?: ('generic' | 'identification_front' | 'identification_back') | undefined, file_data: string, filename: string}) | undefined}>, phone_numbers: Array<{phone_number?: string | undefined}>, wealth_and_employment_details?: ({employment_status?: ('employed' | 'retired' | 'self_employed' | 'student' | 'unemployed') | undefined, occupation?: ('consulting' | 'executive' | 'finance_accounting' | 'food_services' | 'government' | 'healthcare' | 'legal_services' | 'manufacturing' | 'sales' | 'science_engineering' | 'technology') | undefined, industry?: ('accounting' | 'agriculture' | 'automotive' | 'chemical_manufacturing' | 'construction' | 'educational_medical' | 'food_service' | 'finance' | 'gasoline' | 'health_store' | 'laundry' | 'maintenance' | 'manufacturing' | 'merchant_wholesale' | 'mining' | 'performing_arts' | 'professional_arts' | 'public_administration' | 'publishing' | 'real_estate' | 'recreation_gambling' | 'religous_charity' | 'rental_services' | 'retail_clothing' | 'retail_electronics' | 'retail_food' | 'retail_furnishing' | 'retail_home' | 'retail_non_store' | 'retail_sporting' | 'transportation' | 'travel' | 'utilities') | undefined, income_source?: ('family_support' | 'government_benfits' | 'inheritance' | 'investments' | 'rental_income' | 'retirement' | 'salary' | 'self_employed') | undefined, income_state?: string | undefined, income_country?: string | undefined, employer_name?: string | undefined, employer_state?: string | undefined, employer_country?: string | undefined, source_of_funds?: ('alimony' | 'annuity' | 'business_owner' | 'general_employee' | 'government_benfits' | 'homemaker' | 'inheritance_gift' | 'investments' | 'legal_settlement' | 'lottery' | 'real_estate' | 'retired' | 'retirement' | 'salary' | 'self_employed' | 'senior_executive' | 'trust_income' | 'business_revenue' | 'debt_financing' | 'intercompany_loan' | 'investor_funding' | 'retained_earnings_or_savings' | 'sale_of_business_assets' | 'sale_of_real_estate') | undefined, wealth_source?: ('business_sale' | 'family_support' | 'government_benefits' | 'inheritance' | 'investments' | 'other' | 'rental_income' | 'retirement' | 'salary' | 'self_employed') | undefined, annual_income?: number | undefined}) | undefined, email: string, addresses: Array<{address_types?: Array | undefined, line1: string, line2?: string | undefined, locality: string, region?: string | undefined, postal_code?: string | undefined, primary?: boolean | undefined}>, website?: string | undefined, metadata?: unknown | undefined, intended_use?: string | undefined, expected_activity_volume?: number | undefined, primary_social_media_sites?: Array | undefined, external_id?: string | undefined}) | undefined, child_legal_entity_id?: string | undefined}>) | undefined, business_description: string, intended_use: string, expected_activity_volume: string, country_of_incorporation?: string | undefined, operating_jurisdictions?: Array | undefined, ticker_symbol?: string | undefined, listed_exchange?: string | undefined, connection_id?: string | undefined, documents?: (Array<{document_type: 'articles_of_incorporation' | 'generic' | 'certificate_of_good_standing' | 'proof_of_address', file_data: string, filename: string}>) | undefined, external_id?: string | undefined, service_provider_legal_entity_id?: string | undefined, terms_of_use?: ({accepted_at: string, ip_address: string} | null) | undefined, business_designation?: ('non_operating_business' | 'exempt_financial_institution') | undefined}}; export type CreateApiLegalEntitiesOptions = {baseUrl?: string | undefined, sec0?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Create Legal Entity * * POST /legal_entities */ export const createApiLegalEntities = async (args: CreateApiLegalEntitiesArgs, options?: CreateApiLegalEntitiesOptions) => { const {baseUrl = "https://app.moderntreasury.com/api", fetch: fetchFn = fetch, sec0} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (sec0 !== undefined) headers.set('authorization', `Basic ${btoa(`${sec0.username}:${sec0.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/legal_entities${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };