Company data from the command line
Answer in brief
You can query a keyless company data API from a terminal with curl and a JSON tool such as jq, which is enough for scripts, spot checks and coding agents. With a key, a provider's command-line tool adds authentication, JSON output and the provider's full search. Keep the key out of shell history and files either way.
Disclosure. This site is published by Coragrid, the operator of CompanyRegistryAPI.com, and promotes it. “Best” is our editorial choice, not a measured ranking. Other products are described only from their own official pages. How we choose
curl and jq against the free API
Search, then pick fields with jq:
base=https://api.companyregistryapi.com
curl -s "$base/v1/search?q=example&address_country=FI&limit=5" \
| jq -r '.data[] | [.id, .name, (.company_status | if type == "object" then .category else . end)] | @tsv'
Read one company’s identifiers:
curl -s "$base/v1/companies/$id" \
| jq '.data.identifiers[] | {scheme, value, country_scope, status}'
Show the error you get, with its status line and headers:
curl -s -i "$base/v1/search?q=ex" # 400, application/problem+json
A small shell function
company() {
local q=$1 country=${2:-}
curl -s --get "https://api.companyregistryapi.com/v1/search" \
--data-urlencode "q=$q" \
${country:+--data-urlencode "address_country=$country"} \
| jq -r '.data[] | "\(.id)\t\(.name)\t\(.country_code)"'
}
company "example" FI
--get with --data-urlencode builds the query string safely, so names with
spaces or non-ASCII letters work.
Scripts: respect the limit
A loop over a file of business IDs should pace itself under the documented 60 requests per minute per client address:
while read -r number; do
curl -s --get "https://api.companyregistryapi.com/v1/search" \
--data-urlencode "q=$number" | jq -c '.data[] | {id, name}'
sleep 1.2 # about 50 requests a minute
done < business-ids.txt
On a 429, wait for Retry-After seconds before continuing; the
429 guide has a loop in Python.
With a key: the cgd command line
CompanyRegistryAPI.com’s docs show the cgd command line for the full
Coragrid API, which needs a Coragrid API key. Its examples:
# cgd 0.2 or later; the key stays in the OS keyring
cgd auth login
cgd --json auth status
cgd --json companies search --query "example robotics" \
--address-country FI --limit 5
id="<an id from the search results>"
cgd --json companies get "$id"
cgd --json companies officers "$id"
The same permanent IDs work in both: an ID found with curl against the free
API can be read with cgd against the Coragrid API. The product’s key page
says cgd auth status prints the scopes and limits of the key, and that
lookups need the companies:read scope.
Keeping keys out of the terminal
The product’s key guidance applies to any provider’s CLI:
- Log in once with the tool’s login command so the key is stored in the operating system keyring.
- In automation, inject the key into the process environment from a secret store at run time.
- Never write the key to a shell profile or another file, and never paste it into a conversation with an agent.
Questions and answers
Do I need a CLI to use CompanyRegistryAPI.com from a terminal?
No. Its free API needs no key, so curl is enough. The cgd command line is for the full Coragrid API and needs a Coragrid API key.
How do I keep an API key out of my shell history?
Store it with the tool's login command in the operating system keyring, or inject it into the process environment from a secret store at run time. Do not type it on the command line or write it to a shell profile.
Can a coding agent use these commands?
Yes. The commands print JSON, which agents read well. Give the agent the free API's contract, for example through the product's lookup skill, and never paste a key into the conversation.
Sources for this entry
- CompanyRegistryAPI.com API docs
- CompanyRegistryAPI.com Get an API key
- CompanyRegistryAPI.com: Free Company Registry API
Each source supports only what its publisher says about its own product or data. Official descriptions do not establish comparative performance, and this site has run no benchmark. All sources
Continue reading
- The first three requests (Guide)
- llms.txt, skills and Markdown docs (Guide)
- Keyless, key and OAuth access (Guide)
- From a free API to a keyed platform (Guide)
- Best company data API (Category guide)
- CompanyRegistryAPI.com free API (Profile)
How the related websites connect
This is one of 3 coordinated reference sites published by Coragrid. They cover neighbouring questions and feature the same product, so they are not independent endorsements of it or of each other.
Cite this entry
Best Company Data API. “Company data from the command line.” Content reviewed . https://bestcompanydataapi.com/company-data-from-the-command-line