### Quick Start Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md A basic example demonstrating how to use the SDK to check organization credits and perform company and people searches. ```APIDOC ## Quick Start ```typescript import { peopleSearch, companySearch, getOrgCredits } from '@fiberai/sdk'; // Check your organization's credit balance const credits = await getOrgCredits({ query: { apiKey: 'your-api-key' } }); console.log(`Available credits: ${credits.data.output.available}`); // Search for companies const companies = await companySearch({ body: { apiKey: 'your-api-key', searchParams: { industriesV2: { anyOf: ['Software', 'Information Technology'] }, employeeCountV2: { lowerBoundExclusive: 100, upperBoundInclusive: 1000 }, headquartersCountryCode: { anyOf: ['USA'] } }, pageSize: 25 } }); // Search for people const people = await peopleSearch({ body: { apiKey: 'your-api-key', searchParams: { title: ['CEO', 'CTO', 'VP Engineering'], location: { cities: ['San Francisco, CA'] } }, pageSize: 25 } }); ``` ``` -------------------------------- ### Fiber AI SDK Authentication Examples Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md Illustrates how to authenticate with the Fiber AI API using an API key, both in POST and GET requests. Recommends storing API keys in environment variables. ```typescript // POST request example await companySearch({ body: { apiKey: process.env.FIBERAI_API_KEY, searchParams: { /* ... */ } } }); // GET request example await getOrgCredits({ query: { apiKey: process.env.FIBERAI_API_KEY } }); ``` -------------------------------- ### Installation Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md Instructions on how to install the Fiber AI TypeScript SDK using npm, yarn, or pnpm. Requires Node.js 18.0.0 or higher. ```APIDOC ## Installation ```bash npm install @fiberai/sdk # or yarn add @fiberai/sdk # or pnpm add @fiberai/sdk ``` **Requirements:** Node.js 18.0.0 or higher ``` -------------------------------- ### Install @fiberai/sdk using npm, yarn, or pnpm Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md Instructions for installing the @fiberai/sdk package using different package managers. Requires Node.js 18.0.0 or higher. ```bash npm install @fiberai/sdk # or yarn add @fiberai/sdk # or pnpm add @fiberai/sdk ``` -------------------------------- ### Quick Start: Fiber AI SDK Usage in TypeScript Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md Demonstrates basic usage of the Fiber AI SDK in TypeScript, including checking organization credits and performing company and people searches. Requires an API key. ```typescript import { peopleSearch, companySearch, getOrgCredits } from '@fiberai/sdk'; // Check your organization's credit balance const credits = await getOrgCredits({ query: { apiKey: 'your-api-key' } }); console.log(`Available credits: ${credits.data.output.available}`); // Search for companies const companies = await companySearch({ body: { apiKey: 'your-api-key', searchParams: { industriesV2: { anyOf: ['Software', 'Information Technology'] }, employeeCountV2: { lowerBoundExclusive: 100, upperBoundInclusive: 1000 }, headquartersCountryCode: { anyOf: ['USA'] } }, pageSize: 25 } }); // Search for people const people = await peopleSearch({ body: { apiKey: 'your-api-key', searchParams: { title: ['CEO', 'CTO', 'VP Engineering'], location: { cities: ['San Francisco, CA'] } }, pageSize: 25 } }); ``` -------------------------------- ### Store API Key in Environment Variable (.env) Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md Example of how to store your Fiber AI API key securely in an environment variable file. ```bash # .env FIBERAI_API_KEY=your_api_key_here ``` -------------------------------- ### AI-Powered Company Research with TypeScript Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md This example demonstrates how to use AI agents for company research and domain lookup via the FiberAI SDK. It covers triggering a domain lookup for a list of company names and then polling for the results. The process requires an API key and uses a run ID to track the AI agent's progress. Output includes the best domain, confidence score, and rationale. ```typescript import { domainLookupTrigger, domainLookupPolling } from '@fiberai/sdk'; // Trigger domain lookup for company names const lookup = await domainLookupTrigger({ body: { apiKey: process.env.FIBERAI_API_KEY, companyNames: [ 'OpenAI', 'Anthropic', 'Stripe' ] } }); // Poll for results let lookupDone = false; while (!lookupDone) { await new Promise(resolve => setTimeout(resolve, 3000)); const results = await domainLookupPolling({ body: { apiKey: process.env.FIBERAI_API_KEY, domainAgentRunId: lookup.data.output.domainAgentRunId, pageSize: 10 } }); lookupDone = results.data.output.status === 'DONE'; if (lookupDone) { results.data.output.data.forEach(company => { console.log(`${company.companyName}: ${company.bestDomain}`); console.log(`Confidence: ${company.confidence}/10`); console.log(`Rationale: ${company.rationale}`); }); } } ``` -------------------------------- ### Implement Pagination Helper with TypeScript Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md This example provides a TypeScript generator function `paginateSearch` that simplifies handling paginated API responses. It takes a search function and its parameters, automatically managing cursors to fetch all data items. The function yields batches of items, making it easy to process large datasets iteratively. Usage involves a `for await...of` loop. ```typescript async function* paginateSearch(searchFn, params) { let cursor = null; do { const result = await searchFn({ ...params, body: { ...params.body, cursor } }); yield result.data.output.data.items; cursor = result.data.output.nextCursor; } while (cursor); } // Usage for await (const companies of paginateSearch(companySearch, { body: { apiKey: process.env.FIBERAI_API_KEY, searchParams: { /* ... */ }, pageSize: 100 } })) { console.log(`Processing batch of ${companies.length} companies`); // Process batch } ``` -------------------------------- ### Authentication Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md Details on how to authenticate API requests using an API key, including how to include it in POST and GET requests and best practices for storing it. ```APIDOC ## Authentication All API requests require an API key. Get yours at [fiber.ai/app/api](https://fiber.ai/app/api). **Include your API key in every request:** - **POST requests**: Pass `apiKey` in the request body - **GET requests**: Pass `apiKey` as a query parameter ```typescript // POST request example await companySearch({ body: { apiKey: process.env.FIBERAI_API_KEY, searchParams: { /* ... */ } } }); // GET request example await getOrgCredits({ query: { apiKey: process.env.FIBERAI_API_KEY } }); ``` **Best Practice:** Store your API key in environment variables: ```bash # .env FIBERAI_API_KEY=your_api_key_here ``` ``` -------------------------------- ### Perform Kitchen Sink Lookups with TypeScript Source: https://context7.com/fiber-ai/typescript-sdk/llms.txt This snippet demonstrates how to perform single person, single company, and bulk profile lookups using the FiberAI SDK. It requires an API key and allows specifying various identifiers for lookups. The `liveFetch` option controls whether to fetch live data or use cached data. ```typescript import { kitchenSinkProfile, kitchenSinkCompany, kitchenSinkBulkProfile } from '@fiberai/sdk'; // Single person lookup (2 credits) const person = await kitchenSinkProfile({ body: { apiKey: process.env.FIBERAI_API_KEY, linkedinUrl: 'https://www.linkedin.com/in/example', // Or use other identifiers: // linkedinSlug: 'example', // email: 'person@company.com', // name: 'John Doe', // companyDomain: 'company.com' liveFetch: false } }); // Single company lookup (2 credits) const company = await kitchenSinkCompany({ body: { apiKey: process.env.FIBERAI_API_KEY, linkedinUrl: 'https://www.linkedin.com/company/example' // Or: domain: 'example.com', name: 'Example Inc' } }); // Bulk profile lookup const bulkProfiles = await kitchenSinkBulkProfile({ body: { apiKey: process.env.FIBERAI_API_KEY, people: [ { linkedinUrl: 'https://linkedin.com/in/person1' }, { linkedinUrl: 'https://linkedin.com/in/person2' } ], liveFetch: false } }); ``` -------------------------------- ### Contact Enrichment API Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md Get emails and phone numbers for LinkedIn profiles. Supports both asynchronous and synchronous operations. ```APIDOC ## POST /enrich/contact/async/trigger ### Description Initiates an asynchronous contact enrichment task. ### Method POST ### Endpoint /enrich/contact/async/trigger ### Parameters #### Request Body - **apiKey** (string) - Required - Your FiberAI API key. - **linkedinUrl** (string) - Required - The LinkedIn profile URL. - **dataToFetch** (object) - Required - Specifies which data to fetch. - **workEmail** (boolean) - Whether to fetch work email. - **personalEmail** (boolean) - Whether to fetch personal email. - **phoneNumber** (boolean) - Whether to fetch phone number. - **liveFetch** (boolean) - Optional - Set to true for real-time LinkedIn scraping (consumes more credits). ### Request Example ```json { "apiKey": "YOUR_API_KEY", "linkedinUrl": "https://www.linkedin.com/in/example", "dataToFetch": { "workEmail": true, "personalEmail": true, "phoneNumber": true }, "liveFetch": false } ``` ### Response #### Success Response (200) - **data** (object) - **output** (object) - **taskId** (string) - The ID of the enrichment task, used for polling. #### Response Example ```json { "data": { "output": { "taskId": "enrichmentTaskId123" } } } ``` ## POST /enrich/contact/async/poll ### Description Polls for the results of an asynchronous contact enrichment task. ### Method POST ### Endpoint /enrich/contact/async/poll ### Parameters #### Request Body - **apiKey** (string) - Required - Your FiberAI API key. - **taskId** (string) - Required - The ID of the enrichment task. ### Request Example ```json { "apiKey": "YOUR_API_KEY", "taskId": "enrichmentTaskId123" } ``` ### Response #### Success Response (200) - **data** (object) - **output** (object) - **done** (boolean) - Indicates if the enrichment is complete. - **profile** (object) - The enriched profile data (if done). - **emails** (array) - List of email addresses. - **phoneNumbers** (array) - List of phone numbers. #### Response Example ```json { "data": { "output": { "done": true, "profile": { "emails": ["john.doe@example.com"], "phoneNumbers": ["+1234567890"] } } } } ``` ## POST /enrich/contact/sync ### Description Performs a synchronous contact enrichment, waiting for the results. ### Method POST ### Endpoint /enrich/contact/sync ### Parameters #### Request Body - **apiKey** (string) - Required - Your FiberAI API key. - **linkedinUrl** (string) - Required - The LinkedIn profile URL. - **dataToFetch** (object) - Required - Specifies which data to fetch. - **workEmail** (boolean) - Whether to fetch work email. - **personalEmail** (boolean) - Whether to fetch personal email. - **phoneNumber** (boolean) - Whether to fetch phone number. ### Request Example ```json { "apiKey": "YOUR_API_KEY", "linkedinUrl": "https://www.linkedin.com/in/example", "dataToFetch": { "workEmail": true, "personalEmail": false, "phoneNumber": false } } ``` ### Response #### Success Response (200) - **data** (object) - **output** (object) - **profile** (object) - **emails** (array) - List of email addresses. - **phoneNumbers** (array) - List of phone numbers. #### Response Example ```json { "data": { "output": { "profile": { "emails": ["john.doe@example.com"], "phoneNumbers": [] } } } } ``` ``` -------------------------------- ### Company Count API Source: https://context7.com/fiber-ai/typescript-sdk/llms.txt Get the total count of companies matching the specified search criteria. This operation costs 1 credit. ```APIDOC ## POST /companies/count ### Description Get the total count of companies matching the specified search criteria. This operation costs 1 credit. ### Method POST ### Endpoint /companies/count ### Parameters #### Request Body - **apiKey** (string) - Required - Your Fiber AI API key. - **searchParams** (object) - Required - Parameters for searching companies. - **industriesV2** (object) - Optional - Filter by industry (e.g., { anyOf: ['Software', 'Cloud'] }). - **employeeCountV2** (object) - Optional - Filter by employee count (e.g., { lowerBoundExclusive: 50, upperBoundInclusive: 500 }). - **headquartersCountryCode** (object) - Optional - Filter by headquarters country code (e.g., { anyOf: ['USA'] }). - **totalFundingUSD** (object) - Optional - Filter by total funding in USD (e.g., { lowerBound: 1000000 }). - **keywords** (object) - Optional - Filter by keywords (e.g., { containsAny: ['venture-backed-startup'] }). ### Request Example ```typescript import { companyCount } from '@fiberai/sdk'; const count = await companyCount({ body: { apiKey: process.env.FIBERAI_API_KEY, searchParams: { industriesV2: { anyOf: ['Software', 'Cloud'] }, employeeCountV2: { lowerBoundExclusive: 50, upperBoundInclusive: 500 } } } }); console.log(`Total matching: ${count.data.output.count}`); ``` ### Response #### Success Response (200) - **data** (object) - **output** (object) - **count** (number) - The total number of companies matching the criteria. #### Response Example ```json { "data": { "output": { "count": 12345 } } } ``` ``` -------------------------------- ### Configure Custom Client Instance Source: https://context7.com/fiber-ai/typescript-sdk/llms.txt Create a custom client instance with specific configurations, such as a custom base URL, for advanced use cases. This allows for more control over API interactions. ```typescript import { createClient, companySearch } from '@fiberai/sdk'; const customClient = createClient({ baseUrl: 'https://api.fiber.ai' }); const result = await companySearch({ client: customClient, body: { apiKey: process.env.FIBERAI_API_KEY, searchParams: { /* ... */ } } }); ``` -------------------------------- ### Company Search API Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md Endpoint for searching companies using various filters such as industry, location, revenue, funding, and keywords. Includes functionality to get the total count of matching companies. ```APIDOC ## POST /companySearch ### Description Search for companies using 40+ filters including industry, location, revenue, funding, and more. You can also get the total count of companies matching your search criteria. ### Method POST ### Endpoint `/companySearch` ### Parameters #### Request Body - **apiKey** (string) - Required - Your Fiber AI API key. - **searchParams** (object) - Required - Object containing the search filters. - **industriesV2** (object) - Optional - Filter by industry. - **anyOf** (array of strings) - List of industries to include. - **employeeCountV2** (object) - Optional - Filter by employee count. - **lowerBoundExclusive** (number) - Minimum employee count (exclusive). - **upperBoundInclusive** (number) - Maximum employee count (inclusive). - **headquartersCountryCode** (object) - Optional - Filter by country code. - **anyOf** (array of strings) - List of country codes to include. - **totalFundingUSD** (object) - Optional - Filter by total funding. - **lowerBound** (number) - Minimum funding amount in USD. - **keywords** (object) - Optional - Filter by keywords. - **containsAny** (array of strings) - List of keywords to search for. - **pageSize** (number) - Optional - Number of results per page (default: 25). - **cursor** (string | null) - Optional - Cursor for pagination. ### Request Example ```json { "apiKey": "YOUR_API_KEY", "searchParams": { "industriesV2": { "anyOf": ["Software", "Cloud"] }, "employeeCountV2": { "lowerBoundExclusive": 50, "upperBoundInclusive": 500 }, "headquartersCountryCode": { "anyOf": ["USA"] }, "totalFundingUSD": { "lowerBound": 1000000 }, "keywords": { "containsAny": ["venture-backed-startup"] } }, "pageSize": 50, "cursor": null } ``` ### Response #### Success Response (200) - **data** (object) - **output** (object) - **items** (array) - Array of company objects matching the search criteria. - **nextCursor** (string | null) - Cursor for the next page of results. #### Response Example ```json { "data": { "output": { "items": [ { "name": "Example Company", "industry": "Software", "employeeCount": 200, "headquarters": { "countryCode": "USA" }, "funding": { "totalRaised": 5000000 } } ], "nextCursor": "some_cursor_string" } } } ``` ## POST /companyCount ### Description Get the total count of companies that match the specified search criteria without retrieving the company data itself. ### Method POST ### Endpoint `/companyCount` ### Parameters #### Request Body - **apiKey** (string) - Required - Your Fiber AI API key. - **searchParams** (object) - Required - Object containing the search filters (same as `companySearch`). ### Request Example ```json { "apiKey": "YOUR_API_KEY", "searchParams": { "industriesV2": { "anyOf": ["Software", "Cloud"] }, "employeeCountV2": { "lowerBoundExclusive": 50, "upperBoundInclusive": 500 }, "headquartersCountryCode": { "anyOf": ["USA"] } } } ``` ### Response #### Success Response (200) - **data** (object) - **output** (object) - **count** (number) - The total number of companies matching the search criteria. #### Response Example ```json { "data": { "output": { "count": 12345 } } } ``` ``` -------------------------------- ### Create and Manage Saved Searches with TypeScript Source: https://context7.com/fiber-ai/typescript-sdk/llms.txt This section details how to create, list, and manage saved searches using the FiberAI SDK. It covers creating a new search with specific parameters, listing existing searches, manually triggering a search run, checking its status, and retrieving results. Note that some operations are free, while others incur credits per result found. ```typescript import { createSavedSearch, listSavedSearch, manuallySpawnSavedSearchRun, getSavedSearchRunStatus, getSavedSearchRunCompanies, getSavedSearchRunProfiles } from '@fiberai/sdk'; // Create a saved search (2 credits per result found) const savedSearch = await createSavedSearch({ body: { apiKey: process.env.FIBERAI_API_KEY, name: 'Tech Executives in SF', searchParams: { companySearchParams: { industriesV2: { anyOf: ['Software'] } }, personSearchParams: { title: ['CEO', 'CTO'], seniority: ['Executive'] } } } }); // List all saved searches (FREE) const searches = await listSavedSearch({ body: { apiKey: process.env.FIBERAI_API_KEY } }); // Manually run a saved search const run = await manuallySpawnSavedSearchRun({ body: { apiKey: process.env.FIBERAI_API_KEY, savedSearchId: savedSearch.data.output.savedSearchId } }); // Check run status (FREE) const status = await getSavedSearchRunStatus({ body: { apiKey: process.env.FIBERAI_API_KEY, runId: run.data.output.runId } }); // Get results when complete (FREE) if (status.data.output.status === 'COMPLETED') { const companies = await getSavedSearchRunCompanies({ body: { apiKey: process.env.FIBERAI_API_KEY, runId: run.data.output.runId, pageSize: 100 } }); const profiles = await getSavedSearchRunProfiles({ body: { apiKey: process.env.FIBERAI_API_KEY, runId: run.data.output.runId, pageSize: 100 } }); } ``` -------------------------------- ### Job Posting Search API Source: https://context7.com/fiber-ai/typescript-sdk/llms.txt Search for job postings with filtering capabilities based on company, location, and job details. This section also includes an endpoint to get the count of matching job postings. ```APIDOC ## Job Posting Search ### Description Search for job postings with filtering by company, location, and job details. Also includes an endpoint to retrieve the count of matching job postings. ### Method POST ### Endpoint `/jobs/search` (for search) `/jobs/count` (for count) ### Parameters #### Request Body (for search and count) - **apiKey** (string) - Required - Your Fiber AI API key. - **searchParams** (object) - Required - Parameters for filtering job postings. - **title** (string[]) - Optional - Array of job titles to search for. - **location** (object) - Optional - Location criteria. - **countries** (string[]) - Optional - Array of country names. - **cities** (string[]) - Optional - Array of city names. - **pageSize** (number) - Optional - Number of results per page (for search). ### Request Example (Search) ```json { "apiKey": "YOUR_API_KEY", "searchParams": { "title": ["Software Engineer", "Backend Developer"], "location": {"cities": ["San Francisco, CA"]} }, "pageSize": 50 } ``` ### Request Example (Count) ```json { "apiKey": "YOUR_API_KEY", "searchParams": { "title": ["Software Engineer"], "location": {"countries": ["USA"]} } } ``` ### Response #### Success Response (200) - **data** (object) - Contains the search results or count. - **output** (object) - The main output object. - **items** (array) - Array of job posting objects (for search). - **title** (string) - The job title. - **company_name** (string) - The name of the company. - **location** (string) - The job location. - **count** (number) - The total number of matching job postings (for count). #### Response Example (Search) ```json { "data": { "output": { "items": [ { "title": "Software Engineer", "company_name": "Tech Corp", "location": "San Francisco, CA" } ] } } } ``` #### Response Example (Count) ```json { "data": { "output": { "count": 150 } } } ``` ``` -------------------------------- ### Custom Client Configuration Source: https://context7.com/fiber-ai/typescript-sdk/llms.txt Create a custom client instance with custom configuration, such as specifying a different base URL, for advanced use cases. ```APIDOC ## Custom Client Configuration ### Description Create a custom client instance with custom configuration for advanced use cases. ### Method N/A (Client-side configuration) ### Endpoint N/A ### Parameters #### Client Configuration Options - **baseUrl** (string) - Optional - The base URL for the API. Defaults to the standard Fiber AI API endpoint. ### Request Example ```typescript import { createClient, companySearch } from '@fiberai/sdk'; const customClient = createClient({ baseUrl: 'https://api.fiber.ai' // Example custom base URL }); // Use the custom client for API calls const result = await companySearch({ client: customClient, body: { apiKey: process.env.FIBERAI_API_KEY, searchParams: { /* ... */ } } }); ``` ### Response N/A (This is a client-side configuration step.) ``` -------------------------------- ### Batch Contact Enrichment with TypeScript Source: https://context7.com/fiber-ai/typescript-sdk/llms.txt Enriches contact details for multiple people in a single batch request using the Fiber AI SDK. It involves starting the batch job and then polling for results until completion. Requires an API key and a list of LinkedIn URLs. ```typescript import { startBatchContactEnrichment, pollBatchContactEnrichment } from '@fiberai/sdk'; const batch = await startBatchContactEnrichment({ body: { apiKey: process.env.FIBERAI_API_KEY, people: [ { linkedinUrl: { value: 'https://linkedin.com/in/person1' } }, { linkedinUrl: { value: 'https://linkedin.com/in/person2' } }, { linkedinUrl: { value: 'https://linkedin.com/in/person3' } } ], dataToFetch: { workEmail: true, personalEmail: true, phoneNumber: true } } }); let cursor = null; let allDone = false; while (!allDone) { await new Promise(resolve => setTimeout(resolve, 5000)); const results = await pollBatchContactEnrichment({ body: { apiKey: process.env.FIBERAI_API_KEY, taskId: batch.data.output.taskId, cursor, take: 100 } }); allDone = results.data.output.done; cursor = results.data.output.nextCursor; results.data.output.pageResults.forEach(person => { if (person.outputs) { console.log('LinkedIn:', person.inputs.linkedinUrl.value); console.log('Emails:', person.outputs.emails); console.log('Phones:', person.outputs.phoneNumbers); } }); } ``` -------------------------------- ### Configure Custom Client with TypeScript Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md This snippet illustrates how to create a custom client instance for the FiberAI SDK, allowing for configuration of the base URL and other network settings like headers or interceptors. This custom client can then be passed to any SDK function for use. It requires the `createClient` function from the SDK. ```typescript import { createClient } from '@fiberai/sdk'; // Create a custom client const customClient = createClient({ baseUrl: 'https://api.fiber.ai', // Production URL // Add custom headers, interceptors, etc. }); // Use with any SDK function import { companySearch } from '@fiberai/sdk'; const result = await companySearch({ client: customClient, body: { /* ... */ } }); ``` -------------------------------- ### Company Search and Count with TypeScript Source: https://context7.com/fiber-ai/typescript-sdk/llms.txt Perform company searches using various filters and retrieve the total count of matching companies. This involves two main functions: `companyCount` for getting the number of results and `companySearch` for retrieving paginated company data. Each operation consumes credits. ```typescript import { companySearch, companyCount } from '@fiberai/sdk'; // Get count before searching (1 credit) const count = await companyCount({ body: { apiKey: process.env.FIBERAI_API_KEY, searchParams: { industriesV2: { anyOf: ['Software', 'Cloud'] }, employeeCountV2: { lowerBoundExclusive: 50, upperBoundInclusive: 500 } } } }); console.log(`Total matching: ${count.data.output.count}`); // Search for companies (1 credit per company found) const result = await companySearch({ body: { apiKey: process.env.FIBERAI_API_KEY, searchParams: { industriesV2: { anyOf: ['Software', 'Cloud'] }, employeeCountV2: { lowerBoundExclusive: 50, upperBoundInclusive: 500 }, headquartersCountryCode: { anyOf: ['USA'] }, totalFundingUSD: { lowerBound: 1000000 }, keywords: { containsAny: ['venture-backed-startup'] } }, pageSize: 50, cursor: null } }); result.data.output.data.items.forEach(company => { console.log(`${company.preferred_name} - ${company.domain}`); }); // Paginate through results const nextPage = await companySearch({ body: { apiKey: process.env.FIBERAI_API_KEY, searchParams: { /* same filters */ }, pageSize: 50, cursor: result.data.output.nextCursor } }); ``` -------------------------------- ### Batch Contact Enrichment with Fiber AI SDK Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md Enriches up to 10,000 contacts in a single request using the Fiber AI SDK. It involves starting a batch enrichment job and then polling for results with pagination. Requires an API key and a list of people with their LinkedIn URLs. ```typescript import { startBatchContactEnrichment, pollBatchContactEnrichment } from '@fiberai/sdk'; // Start batch enrichment const batch = await startBatchContactEnrichment({ body: { apiKey: process.env.FIBERAI_API_KEY, people: [ { linkedinUrl: { value: 'https://linkedin.com/in/person1' } }, { linkedinUrl: { value: 'https://linkedin.com/in/person2' } }, // ... up to 10,000 people ], dataToFetch: { workEmail: true, personalEmail: true, phoneNumber: true } } }); // Poll for results with pagination let cursor = null; let allDone = false; while (!allDone) { await new Promise(resolve => setTimeout(resolve, 5000)); const results = await pollBatchContactEnrichment({ body: { apiKey: process.env.FIBERAI_API_KEY, taskId: batch.data.output.taskId, cursor, take: 100 } }); allDone = results.data.output.done; cursor = results.data.output.nextCursor; // Process page results results.data.output.pageResults.forEach(person => { if (person.outputs) { console.log('LinkedIn:', person.inputs.linkedinUrl.value); console.log('Emails:', person.outputs.emails); console.log('Phones:', person.outputs.phoneNumbers); console.log('---'); } }); } ``` -------------------------------- ### Create and Manage Exclusion Lists with TypeScript Source: https://context7.com/fiber-ai/typescript-sdk/llms.txt This code demonstrates how to create and manage exclusion lists for companies and prospects using the FiberAI SDK. It covers creating a new exclusion list, adding entities to it, and retrieving the excluded entities. These operations are free to perform. ```typescript import { createCompanyExclusionList, addCompaniesToExclusionList, getExcludedCompaniesForExclusionList, createProspectExclusionList } from '@fiberai/sdk'; // Create company exclusion list (FREE) const list = await createCompanyExclusionList({ body: { apiKey: process.env.FIBERAI_API_KEY, name: 'Competitors', isOrganizationWide: true } }); // Add companies to exclusion list (FREE) await addCompaniesToExclusionList({ body: { apiKey: process.env.FIBERAI_API_KEY, listId: list.data.output.listId, companies: [ { domain: 'competitor1.com', linkedinUrl: null }, { domain: 'competitor2.com', linkedinUrl: null } ] } }); // View excluded companies (FREE) const excluded = await getExcludedCompaniesForExclusionList({ body: { apiKey: process.env.FIBERAI_API_KEY, exclusionListId: list.data.output.listId, pageSize: 100 } }); // Create prospect exclusion list (FREE) const prospectList = await createProspectExclusionList({ body: { apiKey: process.env.FIBERAI_API_KEY, name: 'Do Not Contact', isOrganizationWide: true } }); ``` -------------------------------- ### Investor and Investment Search (TypeScript) Source: https://context7.com/fiber-ai/typescript-sdk/llms.txt Enables searching for investors and investment rounds with detailed filtering options. Requires an API key and uses investorSearch and investmentSearch functions. ```typescript import { investorSearch, investmentSearch } from '@fiberai/sdk'; // Search investors (3 credits per investor) const investors = await investorSearch({ body: { apiKey: process.env.FIBERAI_API_KEY, searchParams: { investorType: ['Venture Capital'], headquartersCountryCode: { anyOf: ['USA'] } }, pageSize: 25 } }); // Search investments (2 credits per investment) const investments = await investmentSearch({ body: { apiKey: process.env.FIBERAI_API_KEY, searchParams: { roundType: ['Series A', 'Series B'], amountUSD: { lowerBound: 5000000, upperBound: 50000000 } }, pageSize: 25 } }); ``` -------------------------------- ### Advanced Company Search with Fiber AI SDK Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md Demonstrates an advanced company search using various filters like industry, employee count, location, funding, and keywords. Includes pagination and counting results. ```typescript import { companySearch, companyCount } from '@fiberai/sdk'; // Advanced company search const result = await companySearch({ body: { apiKey: process.env.FIBERAI_API_KEY, searchParams: { // Industry filters industriesV2: { anyOf: ['Software', 'Cloud'] }, // Size filters employeeCountV2: { lowerBoundExclusive: 50, upperBoundInclusive: 500 }, // Location filters headquartersCountryCode: { anyOf: ['USA'] }, // Funding filters totalFundingUSD: { lowerBound: 1000000 }, // Keywords filter keywords: { containsAny: ['venture-backed-startup'] } }, pageSize: 50, cursor: null // For pagination } }); console.log(`Found ${result.data.output.data.items.length} companies`); // Get total count before searching const count = await companyCount({ body: { apiKey: process.env.FIBERAI_API_KEY, searchParams: { /* same filters */ } } }); console.log(`Total companies matching: ${count.data.output.count}`); ``` -------------------------------- ### Type-Safe API Requests with TypeScript Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md Illustrates how to use TypeScript types for defining request parameters and handling responses from the Fiber AI SDK. It demonstrates type-safe construction of search parameters for company searches. ```typescript import type { CompanySearchData, CompanySearchResponse, PeopleSearchData, PeopleSearchResponse, TriggerContactEnrichmentData, PollContactEnrichmentResultResponse } from '@fiberai/sdk'; // Type-safe request const searchParams: CompanySearchData = { body: { apiKey: process.env.FIBERAI_API_KEY!, searchParams: { industriesV2: { anyOf: ['Software'] }, employeeCountV2: { lowerBoundExclusive: 100, upperBoundInclusive: 1000 } }, pageSize: 25 } }; const result: CompanySearchResponse = await companySearch(searchParams); ``` -------------------------------- ### Check Available Credits (TypeScript) Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md Fetches and displays the user's current credit balance, usage, maximum limit, and the reset date for their credits using the `getOrgCredits` function from the Fiber AI SDK. Requires an API key. ```typescript import { getOrgCredits } from '@fiberai/sdk'; const credits = await getOrgCredits({ query: { apiKey: process.env.FIBERAI_API_KEY } }); console.log(`Available: ${credits.data.output.available}`); console.log(`Used: ${credits.data.output.used}`); console.log(`Max: ${credits.data.output.max}`); console.log(`Resets on: ${credits.data.output.usagePeriodResetsOn}`); ``` -------------------------------- ### Handle API Errors by Throwing (TypeScript) Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md Shows how to configure the SDK to throw an error when an API request fails by setting `throwOnError: true`. This simplifies error handling by using a try-catch block. ```typescript try { const result = await companySearch({ body: { apiKey: process.env.FIBERAI_API_KEY, searchParams: { /* ... */ } }, throwOnError: true }); // result.data is guaranteed to exist console.log(result.data.output); } catch (error) { console.error('Request failed:', error); } ``` -------------------------------- ### TypeScript Support Source: https://context7.com/fiber-ai/typescript-sdk/llms.txt The SDK provides full TypeScript support with exported types for all operations, enabling better code completion, type checking, and overall developer experience. ```APIDOC ## TypeScript Support ### Description The SDK provides full TypeScript support with exported types for all operations. ### Usage Import the necessary types from the `@fiberai/sdk` package to leverage type safety in your TypeScript projects. ### Example ```typescript import type { CompanySearchData, CompanySearchResponse, PeopleSearchData, PeopleSearchResponse, TriggerContactEnrichmentData, PollContactEnrichmentResultResponse } from '@fiberai/sdk'; // Define search parameters using the exported type const searchParams: CompanySearchData = { body: { apiKey: process.env.FIBERAI_API_KEY!, searchParams: { industriesV2: { anyOf: ['Software'] }, employeeCountV2: { lowerBoundExclusive: 100, upperBoundInclusive: 1000 } }, pageSize: 25 } }; // The response will be typed according to CompanySearchResponse const result: CompanySearchResponse = await companySearch(searchParams); // Access data with type safety console.log(result.data.output.items); ``` ### Available Types Refer to the SDK's type definitions for a comprehensive list of exported types, including data structures for requests and responses for all available endpoints (e.g., `CompanySearchData`, `CompanySearchResponse`, `PeopleSearchData`, `PeopleSearchResponse`, etc.). ``` -------------------------------- ### Kitchen Sink Lookups Source: https://context7.com/fiber-ai/typescript-sdk/llms.txt Flexible lookup endpoints that accept multiple identification parameters for finding people and companies. ```APIDOC ## Kitchen Sink Lookups Flexible lookup endpoints that accept multiple identification parameters for finding people and companies. ### Single Person Lookup Performs a lookup for a single person using various identifiers. ### Method POST ### Endpoint /kitchenSinkProfile ### Parameters #### Request Body - **apiKey** (string) - Required - Your FiberAI API key. - **linkedinUrl** (string) - Optional - The LinkedIn profile URL. - **linkedinSlug** (string) - Optional - The LinkedIn profile slug. - **email** (string) - Optional - The person's email address. - **name** (string) - Optional - The person's name. - **companyDomain** (string) - Optional - The domain of the person's company. - **liveFetch** (boolean) - Optional - Whether to perform a live fetch (defaults to false). ### Request Example ```json { "apiKey": "YOUR_API_KEY", "linkedinUrl": "https://www.linkedin.com/in/example", "liveFetch": false } ``` ### Response #### Success Response (200) - **data** (object) - Contains the lookup results. #### Response Example ```json { "data": { ... } } ``` --- ### Single Company Lookup Performs a lookup for a single company using various identifiers. ### Method POST ### Endpoint /kitchenSinkCompany ### Parameters #### Request Body - **apiKey** (string) - Required - Your FiberAI API key. - **linkedinUrl** (string) - Optional - The LinkedIn company URL. - **domain** (string) - Optional - The company's domain. - **name** (string) - Optional - The company's name. ### Request Example ```json { "apiKey": "YOUR_API_KEY", "linkedinUrl": "https://www.linkedin.com/company/example" } ``` ### Response #### Success Response (200) - **data** (object) - Contains the lookup results. #### Response Example ```json { "data": { ... } } ``` --- ### Bulk Profile Lookup Performs a lookup for multiple people in bulk. ### Method POST ### Endpoint /kitchenSinkBulkProfile ### Parameters #### Request Body - **apiKey** (string) - Required - Your FiberAI API key. - **people** (array) - Required - An array of person objects to look up. - **linkedinUrl** (string) - Optional - The LinkedIn profile URL for a person. - **linkedinSlug** (string) - Optional - The LinkedIn profile slug for a person. - **email** (string) - Optional - The person's email address. - **name** (string) - Optional - The person's name. - **companyDomain** (string) - Optional - The domain of the person's company. - **liveFetch** (boolean) - Optional - Whether to perform a live fetch (defaults to false). ### Request Example ```json { "apiKey": "YOUR_API_KEY", "people": [ { "linkedinUrl": "https://linkedin.com/in/person1" }, { "linkedinUrl": "https://linkedin.com/in/person2" } ], "liveFetch": false } ``` ### Response #### Success Response (200) - **data** (object) - Contains the lookup results for multiple profiles. #### Response Example ```json { "data": { ... } } ``` ``` -------------------------------- ### Manage Exclusion Lists with TypeScript Source: https://github.com/fiber-ai/typescript-sdk/blob/main/README.md This snippet demonstrates how to create and manage exclusion lists for companies or prospects using the FiberAI SDK. It covers creating a new list, adding companies to it, creating a list from an existing audience, and retrieving excluded companies. Requires an API key for authentication. ```typescript import { createCompanyExclusionList, addCompaniesToExclusionList, getExcludedCompaniesForExclusionList, createCompanyExclusionListFromAudience } from '@fiberai/sdk'; // Create an exclusion list const list = await createCompanyExclusionList({ body: { apiKey: process.env.FIBERAI_API_KEY, name: 'Competitors', isOrganizationWide: true } }); // Add companies to the list await addCompaniesToExclusionList({ body: { apiKey: process.env.FIBERAI_API_KEY, listId: list.data.output.listId, companies: [ { domain: 'competitor1.com', linkedinUrl: null }, { domain: 'competitor2.com', linkedinUrl: null } ] } }); // Create exclusion list from an existing audience const audienceList = await createCompanyExclusionListFromAudience({ body: { apiKey: process.env.FIBERAI_API_KEY, audienceId: 'audience-123', name: 'Existing Customers', isOrganizationWide: true } }); // View excluded companies const excluded = await getExcludedCompaniesForExclusionList({ body: { apiKey: process.env.FIBERAI_API_KEY, exclusionListId: list.data.output.listId, pageSize: 100 } }); ```