Create Case
Creates a new case for organizing files, analyses, and results related to a crash or legal matter.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | No | Case name. Auto-generated from plaintiff/defendant names if not provided. |
plaintiffName | string | Yes | Plaintiff name (injured party) |
defendantName | string | Yes | Defendant name (at-fault party) |
attorneyName | string | Yes | Attorney name handling the case |
side | string | No | Which party the attorney represents: plaintiff or defense. Defaults to plaintiff. |
organizationId | string | No | ID of the organization to associate this case with |
info
Empty string organizationId values are treated as null (no organization).
Response
Returns the created case with:
id: Unique case identifiername: Case name (auto-generated as "PlaintiffLastName v. DefendantLastName" if not provided)plaintiffName: Plaintiff namedefendantName: Defendant nameattorneyName: Attorney nameside: Which party the attorney represents (plaintiffordefense)organizationId: Organization ID (if associated)status: Case status (typically "active")creatorId: ID of the API key or user that created the casecreated: Creation timestamp (Unix seconds)updated: Last modification timestamp (Unix seconds)
Examples
- Go
- TypeScript
import (
"context"
"github.com/silentwitness/go-sdk"
)
// Basic case with required fields only
response, err := silentwitness.Cases.Create(ctx, &silentwitness.CreateCaseRequest{
PlaintiffName: "Jane Smith",
DefendantName: "Bob Johnson",
AttorneyName: "Jane Doe, Esq.",
})
// Auto-generates name: "Smith v. Johnson"
// With custom name
response, err := silentwitness.Cases.Create(ctx, &silentwitness.CreateCaseRequest{
Name: "Smith v. Johnson - Auto Accident",
PlaintiffName: "Jane Smith",
DefendantName: "Bob Johnson",
AttorneyName: "Jane Doe, Esq.",
})
// With side and organization
orgID := "org_abc123"
side := "defense"
response, err := silentwitness.Cases.Create(ctx, &silentwitness.CreateCaseRequest{
PlaintiffName: "Jane Smith",
DefendantName: "Bob Johnson",
AttorneyName: "Jane Doe, Esq.",
Side: &side,
OrganizationId: &orgID,
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Created: %s (ID: %s)\n", response.Case.Name, response.Case.Id)
import { createCase } from "@silentwitness/typescript-sdk";
// Basic case with required fields only
const response = await createCase({
plaintiffName: "Jane Smith",
defendantName: "Bob Johnson",
attorneyName: "Jane Doe, Esq."
});
// Auto-generates name: "Smith v. Johnson"
// With custom name
const response = await createCase({
name: "Smith v. Johnson - Auto Accident",
plaintiffName: "Jane Smith",
defendantName: "Bob Johnson",
attorneyName: "Jane Doe, Esq."
});
// With side and organization
const response = await createCase({
plaintiffName: "Jane Smith",
defendantName: "Bob Johnson",
attorneyName: "Jane Doe, Esq.",
side: "defense",
organizationId: "org_abc123"
});
console.log(`Created: ${response.case.name} (ID: ${response.case.id})`);
Errors
| Code | Description |
|---|---|
INVALID_ARGUMENT | Missing required fields (plaintiffName, defendantName, or attorneyName) |
INVALID_ARGUMENT | Invalid side value (must be plaintiff or defense) |
UNAUTHENTICATED | Invalid or missing API key |