← Back

Connect Your Backend to Agent & LLM Analytics

Overview

Use the REST API to connect your website with a backend written in any programming language. Please contact us if you need help.

Step 1: Start Tracking Visits

In the endpoints where you serve your pages, make an HTTP request to the REST API for each incoming pageview request.

URL
URL https://api.darkvisitors.com/visits
HTTP Method POST
Headers
Authorization A bearer token with your project's access token (e.g. Bearer YOUR_ACCESS_TOKEN). You can get your project's access token by navigating to the Projects page, opening your project, and opening its settings page.
Content-Type This needs to be set to application/json
Body
request_path The URL path of the incoming pageview request
request_method The HTTP method of the incoming pageview request (e.g. GET)
request_headers The HTTP headers of the incoming pageview request, as a key-value object.

Example

curl -X POST https://api.darkvisitors.com/visits \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
        "request_path": "${request.path}",
        "request_method": "${request.method}",
        "request_headers": "${request.headers}"
    }'

Tips

Step 2: Test Your Integration

If your website is correctly connected, you should see visits from the Dark Visitor agent in the realtime timeline within a few seconds.