Skip to main content
The Ruby SDK requires Ruby 3.2 or newer.

Install the SDK

Set your API key

Get a secret API key from the dashboard. Set it in the terminal where you will run the example:
Keep the key in server-side code. Do not expose it in a browser or commit it to source control.

Scrape a webpage

Save this as scrape.rb:
scrape.rb
Run it with the Ruby installation used above:
If your project has a Gemfile, add gem "context.dev", run bundle install, and use bundle exec ruby scrape.rb.

Check the result

The example prints the page content as Markdown. Look for the Example Domain heading; the remaining text and formatting may vary.
Expected heading
If you receive an error, check the key and request details in Troubleshooting. See the Markdown API reference for all parameters and response fields.

Retrieve brand data

Replace the request and final puts with this lookup. It prints the matched company name.

Next steps

Scrape a webpage

Choose which page content to include.

Retrieve brand data

Look up profiles with other company identifiers.