Skip to content
This is a new version of the Kivra Developer Docs. Report issues or share feedback at avsandare.support@kivra.se. The previous version can be found here.

Send your first content

Start with a simple letter and the fictional recipient supplied for sandbox.

Authenticate before making API requests:

Terminal window
BASE64_CREDENTIALS=$(printf '%s' "$KIVRA_CLIENT_ID:$KIVRA_CLIENT_SECRET" | base64)
curl -X POST \
"https://sender.sandbox-api.kivra.com/v1/auth" \
-H "Authorization: Basic $BASE64_CREDENTIALS" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials"

Use recipient matching with the recipient’s SSN, verified email, or VAT number to check that the recipient is eligible to receive content from your tenant. Send content only when the matching response includes the recipient’s identifier.

Terminal window
curl -X POST \
"https://sender.sandbox-api.kivra.com/v2/tenant/$KIVRA_TENANT_KEY/usermatch/ssn" \
-H "Authorization: Bearer $KIVRA_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"list":["YYYYMMDDNNNN"]}'

Create a JSON file with a PDF encoded as Base64:

first-content.json
{
"ssn": "YYYYMMDDNNNN",
"subject": "Welcome to Example Energy",
"type": "letter",
"parts": [
{
"name": "welcome-letter.pdf",
"content_type": "application/pdf",
"data": "BASE64_ENCODED_PDF"
}
]
}

Send it to your sandbox tenant:

Terminal window
curl -X POST \
"https://sender.sandbox-api.kivra.com/v2/tenant/$KIVRA_TENANT_KEY/content" \
-H "Authorization: Bearer $KIVRA_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
--data-binary @first-content.json

Keep personal and sensitive information out of free-text metadata such as subject. A successful request does not replace recipient-experience review. Continue with Review content in sandbox and consult the Send content API reference for all supported fields.