Skip to main content

Quick Start Guide

This guide will help you make your first API call using the Silent Witness SDKs in just a few minutes.

Prerequisites

Before you begin, you'll need:

  1. API Key: Contact support to obtain your API key
  2. Development Environment: Go 1.21+ or Node.js 18+ depending on your chosen SDK

1. Install the Go SDK

go get github.com/silentwitness/go-sdk

2. Create your first client

package main

import (
"context"
"fmt"
"log"

"github.com/silentwitness/go-sdk"
)

func main() {
// Initialize the API client
client := silentwitness.NewClient(silentwitness.Config{
APIKey: "your-api-key",
})

// Create a new case
ctx := context.Background()
caseResp, err := client.Cases.Create(ctx, &silentwitness.CreateCaseRequest{
Name: silentwitness.String("Smith v. Johnson"),
ClientName: silentwitness.String("Jane Smith"),
})
if err != nil {
log.Fatalf("Failed to create case: %v", err)
}

fmt.Printf("Case created successfully\n")
fmt.Printf("Case ID: %s\n", caseResp.CaseId)
fmt.Printf("Status: %s\n", caseResp.Status)
}

3. Run your application

go run main.go

Expected Response

When you run either example, you should see output similar to:

Case created successfully
Case ID: case_1234567890abcdef
Status: active

Complete Analysis in One Call

For most use cases, use StartAnalysis() which handles the entire process automatically:

import (
"context"
"fmt"
"log"
"os"
"time"

silentwitness "github.com/silentwitness/go-sdk"
)

func main() {
silentwitness.Key = "your-api-key"
ctx := context.Background()

// Load vehicle images
img1, _ := os.ReadFile("plaintiff-front.jpg")
img2, _ := os.ReadFile("plaintiff-rear.jpg")

// Start analysis
poller, err := silentwitness.StartAnalysis(ctx, &silentwitness.AnalyzeCaseRequest{
AnalysisType: silentwitness.AnalysisTypeTechnicalReport,
CaseName: silentwitness.String("Smith v. Jones"),
Plaintiff: &silentwitness.VehicleAnalysisData{
Images: [][]byte{img1, img2},
VehicleMake: silentwitness.String("Toyota"),
VehicleModel: silentwitness.String("Camry"),
VehicleYear: silentwitness.String("2020"),
},
})
if err != nil {
log.Fatal(err)
}

// Monitor progress
for !poller.Done() {
fmt.Printf("Status: %s\n", poller.Status())
time.Sleep(5 * time.Second)
}

// Get result
result, err := poller.Result()
if err != nil {
log.Fatal(err)
}

fmt.Printf("Case ID: %s\n", result.CaseID)
fmt.Printf("Report URL: %s\n", result.ReportURL)
}

See the Complete Case Analysis Guide for more examples.

Next Steps

Now that you've made your first API call, here's what you can explore next:

Common Issues

Connection Errors

If you're getting connection errors, check:

  1. Network Access: Ensure your environment can reach core.silentwitness.ai
  2. Firewall Rules: Check if your network allows HTTPS connections
  3. DNS Resolution: Verify that the API domain resolves correctly

Authentication Errors

If you're getting authentication errors:

  1. API Key Format: Ensure your API key starts with sk-
  2. API Key Validity: Check that your API key hasn't been revoked
  3. Client Configuration: Verify the API key is correctly set in your client

Rate Limiting

If you're hitting rate limits:

  1. Implement Backoff: Add exponential backoff when receiving rate limit errors
  2. Monitor Usage: Track your API usage to stay within limits
  3. Request Increase: Contact support if you need higher rate limits

Getting Help