solarOS Organization API

Organization API

Convert one Lead

Converts a Lead into a Customer, Property, and Opportunity. When placeId matches one or more of the Customer's Properties, conversion reuses one the organization has active access to. If none of the matches are accessible, conversion returns 404 without granting access. When no Property matches for that Customer, conversion creates a new Property and gives the organization primary access to it. The Opportunity takes the Lead's Originator, returned as result.opportunity.originatorId. Requires Idempotency-Key. Required scope: leads:convert.

/api/v1/leads/{id}/convert

Converts a Lead into a Customer, Property, and Opportunity. When placeId matches one or more of the Customer's Properties, conversion reuses one the organization has active access to. If none of the matches are accessible, conversion returns 404 without granting access. When no Property matches for that Customer, conversion creates a new Property and gives the organization primary access to it. The Opportunity takes the Lead's Originator, returned as result.opportunity.originatorId. Requires Idempotency-Key. Required scope: leads:convert.

Convert one Lead. Use an organization API key with leads:convert. Check the response envelope and meta.requestId before triggering dependent workflow steps.

Required scopes

leads:convertIdempotency-Key required

Parameters

NameInTypeDescription
idrequiredpathstringLead identifier returned by the Organization API.

Request body

objectrequired
FieldTypeDescription
customerrequiredobjectOptional unless marked required.
customer.firstNamerequiredstringOptional unless marked required.
customer.lastNamerequiredstringOptional unless marked required.
customer.emailrequiredstringOptional unless marked required.
customer.phonestring | nullOptional unless marked required.
customer.displayNamestring | nullOptional unless marked required.
propertyrequiredobjectOptional unless marked required.
property.addressrequiredstringOptional unless marked required.
property.cityrequiredstringOptional unless marked required.
property.staterequiredstringUS state name or abbreviation; normalized by solarOS.
property.zipCoderequiredstringOptional unless marked required.
property.placeIdstring | nullOptional unless marked required.
property.latitudenumber | nullOptional unless marked required.
property.longitudenumber | nullOptional unless marked required.
property.formattedAddressstring | nullOptional unless marked required.
property.countrystringOptional unless marked required.
opportunityrequiredobjectOptional unless marked required.
opportunity.namerequiredstringOptional unless marked required.
opportunity.valuestring | number | nullOptional unless marked required.
opportunity.expectedCloseDatestring | nullOptional unless marked required.
opportunity.ownerIdstring | nullActive or draft same-organization Team Member id. When omitted, the API key default owner for this resource is used. Ownership cannot be changed through generic PATCH endpoints.
opportunity.notesstring | nullOptional unless marked required.
opportunity.salesTypeIds[]array<string>Optional unless marked required.
convertleadRequest
{
  "customer": {
    "firstName": "Ada",
    "lastName": "Lovelace",
    "email": "ada@example.com"
  },
  "property": {
    "address": "1 Market St",
    "city": "San Francisco",
    "state": "CA",
    "zipCode": "94105"
  },
  "opportunity": {
    "name": "Residential solar consultation",
    "salesTypeIds": [
      "sales_type_install"
    ]
  }
}

Responses

201

Lead conversion action envelope

#/components/schemas/OrgApiActionEnvelope

400

Validation or ownership 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:convert

#/components/schemas/OrgApiError

404

Lead not found or no active access to the matching Property

#/components/schemas/OrgApiError

409

Lead already converted or idempotency conflict

#/components/schemas/OrgApiError

429

Rate limit exceeded

#/components/schemas/OrgApiError

Errors

400 Validation or ownership error401 Missing or invalid organization API key402 Organization billing access or an endpoint-specific business quota denied the request403 Missing required scope: leads:convert404 Lead not found or no active access to the matching Property409 Lead already converted or idempotency conflict429 Rate limit exceeded

Static examples

curl -X POST "$SOLAROS_BASE_URL/api/v1/leads/$SOLAROS_LEAD/convert" \
  -H "Authorization: Bearer $SOLAROS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $SOLAROS_IDEMPOTENCY_KEY" \
  --data '{"customer":{"firstName":"Ada","lastName":"Lovelace","email":"ada@example.com"},"property":{"address":"1 Market St","city":"San Francisco","state":"CA","zipCode":"94105"},"opportunity":{"name":"Residential solar consultation","salesTypeIds":["sales_type_install"]}}'