Developers

Build with Subcontext

Put your firm's AI agent, quote forms and lead forms on your website, send leads in from your own systems, and read your products and results through the Subcontext API.

What you can build

Quick start

  1. 1

    Add the chat to your website

    In your Subcontext dashboard, open Agents, your agent, Channels, Web. Switch it on and paste the snippet before </body> on your pages:

    html
    <script
      id="webchat-embed-script"
      src="https://js.subcontext.com/webchat-latest.js"
      data-agent-id="YOUR_AGENT_ID"></script>
  2. 2

    Get an access token for your server

    Create an API application under Integrations, API applications, then exchange its client id and secret for a token that lasts two hours:

    sh
    curl -X POST https://subcontext.com/oauth/token \
      -d grant_type=client_credentials \
      -d client_id=YOUR_CLIENT_ID \
      -d client_secret=YOUR_CLIENT_SECRET \
      -d scope=read \
      -d resource=https://subcontext.com/api/v1
  3. 3

    Call the API

    Send the token in the Authorization header. This lists your products:

    sh
    curl https://subcontext.com/api/v1/products \
      -H "Authorization: Bearer YOUR_ACCESS_TOKEN"