Evidence connector
Use the evidence connector when records live in a CRM or another vendor feed. It maps each record into an SPM observation, keeps each entity in its own partition, and builds signed evidence packs for cases, audits, or CRM views. A JSON profile changes field names without a code change.
Profile fields and mapping
A profile defines these fields:
entity_field: the stable entity identifier.metric_field: the field that names the indicator.text_template: a template such asRisk for {account}: {score}.partition_prefix: the prefix for the entity partition.occurred_at_field: an optional ISO-8601 event time.idempotency_field: an optional stable record identifier.source_kind: an optional source label.
The connector renders the template as source text. It sends the observation to SPM with a partition made from partition_prefix and the sanitised entity value. Repeated records with the same entity, metric, and idempotency key update the source version instead of creating a second source.
Configure the connector
Set the required environment values before starting the service:
export SPM_BASE_URL=https://api.spmos.ai
export SPM_CONNECTOR_WRITE_KEY=your_reusable_ingest_key
export SPM_CONNECTOR_READ_KEY=your_reusable_recall_key
export SPM_CONNECTOR_SIGNING_KEY=your_pack_signing_key
export SPM_CONNECTOR_PROFILES=/path/to/connector.profiles.json
export SPM_CONNECTOR_PACK_DIR=/var/lib/spm/packs
export SPM_CONNECTOR_PUBLIC_URL="$CONNECTOR_PUBLIC_URL"
export SPM_CONNECTOR_TOKEN=your_shared_inbound_secret
Replace the example values. The write and read keys are reusable key tokens with the matching SPM scopes. The connector token guards the write routes (observe, pack, task mutations) and the read routes (GET /packs/{id}, GET /evidence/{source_id}, GET /tasks/{id}) through the X-Connector-Token header. GET /verify/{id} stays open so an auditor can check a signature without the key. An empty connector token leaves loopback-only setups open, so set it whenever another machine can reach the service. Keep the signing key outside the pack directory. Rotation is manual.
Send observations
Create a profile, then send a batch. The request accepts up to 500 observations. The response reports accepted, duplicate, and failed items. Each item includes its input index, an ok value, an error code when needed, and a truncation flag.
curl "$CONNECTOR_URL/connector/crm/observe" \
-H "X-Connector-Token: $SPM_CONNECTOR_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"observations":[
{"account_id":"acme-42","metric":"risk","score":"high","source_uid":"case-7"}
]}'
Missing required profile fields fail that item without aborting the whole batch. SPM refusals count as failures. Quota exhaustion can stop the batch early. Text longer than 12,000 characters is truncated and marked.
Build and use packs
Call POST /cases/{case}/pack with question, partition, and optional top_k. The connector recalls evidence, reads the returned sources, and signs the resulting pack with HMAC-SHA256. It caps evidence at 32 sources. The pack records the recall decision, gate reason, readable text, and unreadable references. A refusal can still produce a useful pack because the refusal is part of the result.
Use these routes after building a pack:
GET /packs/{id}returns the stored pack.GET /verify/{id}recomputes its signature and returns the signed payload and key fingerprint.GET /evidence/{source_id}?pack={id}returns an escaped HTML fragment for embedding.
The connector also exposes file-backed tasks. Create a task with POST /tasks, claim it with POST /tasks/{id}/claim for a 300-second lease, and renew it with POST /tasks/{id}/heartbeat. POST /tasks/{id}/complete builds a pack and stores its ID as the receipt. If the acceptance question is unsupported, the pack records the refusal and its gate reason; the task still records that pack as its receipt. You can close a task that stops with POST /tasks/{id}/abandon and a reason.
Limits
The connector runs as one process and stores packs and tasks on the local filesystem. It has no OAuth flow of its own. It is an adapter, not a queue or a multi-process task service. Use a deployment boundary that protects the pack directory and signing key. Plan signing-key rotation as an operator change. The connector does not decide whether evidence is sufficient; SPM's recall and read results supply that decision.