Back to reference

API Reference

Create a writing style

Creates a writing style template. Sample subjects and messages support Spintax such as `{Hi|Hello}` plus profile variables `{{ First_name }}`, `{{ Last_name }}`, `{{ Title }}`, `{{ Company_name }}`, `{{ Location }}`, and `{{ Industry }}`. Signal samples also support `{{ Signal }}` and `{{ Signal_anonym }}`. Sonarly renders these before content approval; workflow-run message updates must contain final text without unresolved variables.

POST/v1/accounts/{accountGroupId}/writing-styles

Template mode

Template mode is the default. The AI fills variables while preserving the template structure across signal and basic samples.

Signal variables

{{ Signal }} uses a direct reference to the selected signal. {{ Signal_anonym }} softens the same signal without naming the explicit event or source.

Spintax syntax

Use single braces and pipes for alternatives in samples[].message or samples[].subject, for example {Hi|Hello} {{ First_name }}. Keep template variables in double braces.

Syntax handling

The API preserves template text exactly. Use exact double-brace variable names for variables and valid single-brace Spintax groups for randomized alternatives.

Integration notes

Required API permission

templates:write.

Idempotency

not supported; check the current resource state before retrying this request.

Parameters

accountGroupIdPath

Type: string

Account group ID that scopes the request.

Required

Request body

Required

Optional

Content types

application/json

Schema

object

Fields

name

Type: string

Human-readable name for this resource.

Required

description

Type: string

Human-readable description for this resource.

Optional

contentType

Type: direct_message | inmail | direct_message_inmail | email | comment | connection_request

Request field for content type.

Optional

samples

Type: array<object>

Request field for samples.

Required

valuePropositionId

Type: string

Value proposition ID used for campaign messaging.

Optional

includeRules

Type: array<string>

Request field for include rules.

Optional

excludeRules

Type: array<string>

Request field for exclude rules.

Optional

useStrictTemplate

Type: boolean

When true, generated outreach follows the writing-style samples as strict templates.

Optional

Responses

201

Writing style created

Schema: WritingStyleSuccessResponse

400

Request validation failed

Schema: ValidationErrorResponse

401

Invalid or missing API key

Schema: ErrorResponse

403

Missing required permission

Schema: ErrorResponse

429

Rate limit exceeded

Schema: ErrorResponse

500

Internal server error

Schema: ErrorResponse

Response examples

201 Example JSONWritingStyleSuccessResponse
{
    "success": true,
    "data": {
        "id": "507f1f77bcf86cd799439011",
        "name": "Avery Stone",
        "description": "string",
        "contentType": "direct_message",
        "samples": [
            {
                "type": "signal",
                "message": "Thanks for the context. I can send over details this afternoon.",
                "subject": "Quick follow-up",
                "signalTag": "string"
            }
        ],
        "includeRules": [
            "string"
        ],
        "excludeRules": [
            "string"
        ],
        "useStrictTemplate": true,
        "createdAt": "2026-04-28T15:30:00.000Z"
    },
    "error": null,
    "traceId": "507f1f77bcf86cd799439011"
}
400 Example JSONValidationErrorResponse
{
    "success": false,
    "data": null,
    "error": {
        "code": "VALIDATION_ERROR",
        "message": "Thanks for the context. I can send over details this afternoon.",
        "details": "string"
    },
    "traceId": "507f1f77bcf86cd799439011"
}
401 Example JSONErrorResponse
{
    "success": false,
    "data": null,
    "error": {
        "code": "string",
        "message": "Thanks for the context. I can send over details this afternoon.",
        "details": "string"
    },
    "traceId": "507f1f77bcf86cd799439011"
}
403 Example JSONErrorResponse
{
    "success": false,
    "data": null,
    "error": {
        "code": "string",
        "message": "Thanks for the context. I can send over details this afternoon.",
        "details": "string"
    },
    "traceId": "507f1f77bcf86cd799439011"
}
429 Example JSONErrorResponse
{
    "success": false,
    "data": null,
    "error": {
        "code": "string",
        "message": "Thanks for the context. I can send over details this afternoon.",
        "details": "string"
    },
    "traceId": "507f1f77bcf86cd799439011"
}
500 Example JSONErrorResponse
{
    "success": false,
    "data": null,
    "error": {
        "code": "string",
        "message": "Thanks for the context. I can send over details this afternoon.",
        "details": "string"
    },
    "traceId": "507f1f77bcf86cd799439011"
}