BUYAFACTORY.COM · BUY & SELL US FACTORIES DIRECT0% SELLER COMMISSION5-POINT VERIFICATIONDIRECT OWNER-TO-BUYER
BuyAFactory.comVerified US Exchange
Buyer Workspace

Agent CLI & API Docs

Run BuyAFactory.com from your terminal, a research agent, or an automation workflow.

Get started with fsc

Install the BuyAFactory.com CLI package (fsc), generate an API key in Workspace Settings, and connect to https://buyafactory.com (or your local URL when testing). Set the CLI URL or select your profile when prompted.

export FACTORYSCOPE_API_KEY="<key from Workspace Settings>"
export FACTORYSCOPE_API_URL="https://buyafactory.com"
fsc auth login --url "$FACTORYSCOPE_API_URL" --api-key "$FACTORYSCOPE_API_KEY"
fsc ask "Midwest ISO 9001 plastics plants on Odoo" --json

Authorization: Bearer fsc_… authenticates the workspace that created the scoped key. A revoked or invalid key returns 401, a missing scope returns 403, and insufficient credits return 402.

REST API examples

Search and refine a sourcing plan

Send previousPlan to refine a prior response. Requires read:factories.

curl -fsS -X POST "$FACTORYSCOPE_API_URL/api/ai/query" \
  -H "Authorization: Bearer $FACTORYSCOPE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"query":"Midwest ISO 9001 plastics or compounding plants running Odoo, skip PE-backed"}'

Run multi-source live discovery

Requires Scout+ plan with run:discovery and spend:credits. Supports all, web_enrichment, openfda, epa_echo, and odoo_directory. Charges 5 credits per returned factory.

curl -fsS -X POST "$FACTORYSCOPE_API_URL/api/discovery/run" \
  -H "Authorization: Bearer $FACTORYSCOPE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"query":"Midwest ISO 9001 and FDA medical plants","source":"all","limit":5}'

Reveal a verified owner contact

Requires read:factories and spend:credits. The first reveal for a workspace and factory costs 2 credits.

curl -fsS -X POST "$FACTORYSCOPE_API_URL/api/factories/fac-jeda-polymers/reveal" \
  -H "Authorization: Bearer $FACTORYSCOPE_API_KEY"

Agent examples

Claude Code

Use the terminal to search the existing catalog and review the interpreted filters.

fsc ask "Iowa compounding plants, independent founders only" --json

Codex

Inspect the API contract and use it to validate tool inputs before issuing a request.

curl -fsS "$FACTORYSCOPE_API_URL/api/openapi.json"

Hermes

Give Hermes a scoped key and budget before enabling live lookup. Use JSON output for the tool response.

fsc ask "Go pull 5 US manufacturers from Odoo" --go-fetch --json

n8n

Add an HTTP Request node with Method POST and JSON body. Store the API key in an n8n credential for the Authorization header.

POST /api/ai/query
Authorization: Bearer fsc_…
Content-Type: application/json

{"query":"Michigan injection molders, independent only"}