solarOS Organization API

Organization API

Create a Lead

Creates one Lead for the authenticated organization, including website form submissions and external CRM imports. Requires Idempotency-Key. Supports Campaign attribution, Sales Type assignment, Lead Source, owner/default-owner assignment, an Originator (the owner is credited when originatorId is omitted), standard contact/address fields, customFields, and External References. Use /v1/schema before calling to discover valid customFields and required Field values. External References are created transactionally and conflicts return 409. Side effects include API actor ActivityLog, domain outbox event, idempotency capture, and usage telemetry. Required scope: leads:write.

/api/v1/leads

Creates one Lead for the authenticated organization, including website form submissions and external CRM imports. Requires Idempotency-Key. Supports Campaign attribution, Sales Type assignment, Lead Source, owner/default-owner assignment, an Originator (the owner is credited when originatorId is omitted), standard contact/address fields, customFields, and External References. Use /v1/schema before calling to discover valid customFields and required Field values. External References are created transactionally and conflicts return 409. Side effects include API actor ActivityLog, domain outbox event, idempotency capture, and usage telemetry. Required scope: leads:write.

Create a Lead. Use an organization API key with leads:write. Check the response envelope and meta.requestId before triggering dependent workflow steps.

Required scopes

leads:writeIdempotency-Key required

Parameters

No path or query parameters.

Request body

#/components/schemas/LeadCreateRequestrequired
FieldTypeDescription
firstNamerequiredstringOptional unless marked required.
lastNamerequiredstringOptional unless marked required.
emailstringOptional unless marked required.
phonestringOptional unless marked required.
addressstringOptional unless marked required.
citystringOptional unless marked required.
statestringOptional unless marked required.
zipCodestringOptional unless marked required.
statusNEW | CONTACTED | QUALIFIED | UNQUALIFIEDOptional unless marked required.
sourceIdstringOptional unless marked required.
campaignIdstringOptional unless marked required.
salesTypeIds[]array<string>Optional unless marked required.
ownerIdstringOptional unless marked required.
originatorIdstring | nullThe active or draft same-organization Team Member credited with bringing this sale in. When omitted, the owner is credited.
notesstringOptional unless marked required.
customFieldsobjectField Values keyed by savedIdentity from /v1/schema resources.leads.customFields.
externalReferences[]array<object>Optional unless marked required.
externalReferences[].externalSystemrequiredstringOptional unless marked required.
externalReferences[].externalObjectrequiredstringOptional unless marked required.
externalReferences[].externalIdrequiredstringOptional unless marked required.
websiteLeadForm
{
  "firstName": "Ada",
  "lastName": "Lovelace",
  "email": "ada@example.com",
  "phone": "+15555550123",
  "address": "1 Market St",
  "city": "San Francisco",
  "state": "CA",
  "zipCode": "94105",
  "sourceId": "source_website",
  "campaignId": "campaign_spring_2026",
  "salesTypeIds": [
    "sales_type_install"
  ],
  "notes": "Submitted the rooftop solar estimate form.",
  "customFields": {
    "roofType": "tile"
  },
  "externalReferences": [
    {
      "externalSystem": "website",
      "externalObject": "ContactFormSubmission",
      "externalId": "form_submission_123",
      "metadata": {
        "page": "/solar-estimate"
      }
    }
  ]
}
leadWithCustomFields
{
  "firstName": "Ada",
  "lastName": "Lovelace",
  "email": "ada@example.com",
  "ownerId": "team_member_123",
  "sourceId": "source_123",
  "customFields": {
    "roofType": "tile"
  },
  "externalReferences": [
    {
      "externalSystem": "salesforce",
      "externalObject": "Lead",
      "externalId": "00Q123"
    }
  ]
}

Responses

201

Created Lead envelope

#/components/schemas/LeadEnvelope

400

Validation, ownership, idempotency, or custom Field error

#/components/schemas/OrgApiError

401

Missing or invalid organization API key

#/components/schemas/OrgApiError

402

Organization billing access or an endpoint-specific business quota denied the request

#/components/schemas/OrgApiError

403

Missing required scope: leads:write

#/components/schemas/OrgApiError

409

Idempotency or External Reference conflict

#/components/schemas/OrgApiError

429

Rate limit exceeded

#/components/schemas/OrgApiError

Errors

400 Validation, ownership, idempotency, or custom Field error401 Missing or invalid organization API key402 Organization billing access or an endpoint-specific business quota denied the request403 Missing required scope: leads:write409 Idempotency or External Reference conflict429 Rate limit exceeded

Static examples

curl -X POST "$SOLAROS_BASE_URL/api/v1/leads" \
  -H "Authorization: Bearer $SOLAROS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $SOLAROS_IDEMPOTENCY_KEY" \
  --data '{"firstName":"Ada","lastName":"Lovelace","email":"ada@example.com","phone":"+15555550123","address":"1 Market St","city":"San Francisco","state":"CA","zipCode":"94105","sourceId":"source_website","campaignId":"campaign_spring_2026","salesTypeIds":["sales_type_install"],"notes":"Submitted the rooftop solar estimate form.","customFields":{"roofType":"tile"},"externalReferences":[{"externalSystem":"website","externalObject":"ContactFormSubmission","externalId":"form_submission_123","metadata":{"page":"/solar-estimate"}}]}'