Language-specific quickstarts
Each snippet submits a compliant onboarding workflow, storing consent, routing through the rules engine, and logging immutable evidence. Copy an environment-ready example or adapt it to your deployment pipeline.
cURL quickstart
Test the REST API with a minimal onboarding request. Ideal for smoke testing networking, credentials, and environment routing.
curl -X POST 'https://api.autokyc.com/v1/kyc/onboard' \
-H 'Authorization: Bearer $AUTOKYC_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"applicant": {
"email": "casey@example.com",
"firstName": "Casey",
"lastName": "Nguyen",
"dob": "1993-04-12"
},
"workflow": "standard_kyc",
"channels": ["web", "mobile"],
"consent": {
"marketing": false,
"termsAcceptedAt": "2024-04-05T13:20:40Z"
}
}'
Tip: Swap standard_kyc with your policy slug to reuse the same decisioning logic for ODD and EDD refreshes.
JavaScript quickstart
Use the official JavaScript SDK to initialise the web embed, listen for decision events, and pass custom metadata.
import { AutoKYC } from '@autokyc/web-sdk';
const widget = new AutoKYC({
apiKey: process.env.AUTOKYC_PUBLISHABLE_KEY,
workflow: 'standard_kyc',
applicant: {
referenceId: 'cust_90210',
email: 'casey@example.com',
},
locale: 'en',
});
widget.mount('#autokyc-onboarding');
widget.on('completed', async (payload) => {
await fetch('/api/kyc/callback', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
});
});
Tip: Swap standard_kyc with your policy slug to reuse the same decisioning logic for ODD and EDD refreshes.
import os
import requests
API_KEY = os.environ['AUTOKYC_API_KEY']
BASE_URL = 'https://api.autokyc.com/v1'
payload = {
"workflow": "standard_kyc",
"applicant": {
"email": "casey@example.com",
"firstName": "Casey",
"lastName": "Nguyen",
},
"metadata": {
"productTier": "premium",
"referrer": "web_checkout"
}
}
response = requests.post(
f"{BASE_URL}/kyc/onboard",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json=payload,
timeout=10,
)
response.raise_for_status()
print(response.json())
Tip: Swap standard_kyc with your policy slug to reuse the same decisioning logic for ODD and EDD refreshes.
package main
import (
"bytes"
"context"
"encoding/json"
"log"
"net/http"
"os"
"time"
)
type Applicant struct {
Email string `json:"email"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
}
type RequestBody struct {
Workflow string `json:"workflow"`
Applicant Applicant `json:"applicant"`
}
func main() {
body := RequestBody{
Workflow: "standard_kyc",
Applicant: Applicant{
Email: "casey@example.com",
FirstName: "Casey",
LastName: "Nguyen",
},
}
payload, err := json.Marshal(body)
if err != nil {
log.Fatal(err)
}
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
req, err := http.NewRequestWithContext(ctx, http.MethodPost, "https://api.autokyc.com/v1/kyc/onboard", bytes.NewBuffer(payload))
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("AUTOKYC_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
if res.StatusCode >= 300 {
log.Fatalf("unexpected status: %s", res.Status)
}
}
Tip: Swap standard_kyc with your policy slug to reuse the same decisioning logic for ODD and EDD refreshes.