Skip to main content
POST
/
leads
Create a lead
curl --request POST \
  --url https://api.nomos.energy/leads \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "plan": "pln_mi4f0oda6x9m7gcsvjk0ole1",
  "address": {
    "zip": "10115",
    "street": "Torstraße",
    "city": "Berlin",
    "house_number": "119"
  },
  "meter": {
    "estimated_usage": 2500,
    "type": "smart",
    "number": "1APA0195124010"
  },
  "customer": {
    "type": "person",
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe@example.com"
  },
  "payment_method": {
    "type": "sepa_debit",
    "sepa_debit": {
      "iban": "DE68500105178297336485",
      "account_holder": "John Doe"
    }
  },
  "previous_supplier": "mp_mi4f0oda6x9m7gcsvjk0ole1",
  "next_possible_start": true,
  "intended_start_date": "2024-01-01",
  "change_reason": "supplier_change",
  "created_by": "john.doe@example.com",
  "metadata": {
    "utm_source": "google",
    "utm_campaign": "campaign_name",
    "user_id": "1234567890"
  }
}
'
import requests

url = "https://api.nomos.energy/leads"

payload = {
"plan": "pln_mi4f0oda6x9m7gcsvjk0ole1",
"address": {
"zip": "10115",
"street": "Torstraße",
"city": "Berlin",
"house_number": "119"
},
"meter": {
"estimated_usage": 2500,
"type": "smart",
"number": "1APA0195124010"
},
"customer": {
"type": "person",
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com"
},
"payment_method": {
"type": "sepa_debit",
"sepa_debit": {
"iban": "DE68500105178297336485",
"account_holder": "John Doe"
}
},
"previous_supplier": "mp_mi4f0oda6x9m7gcsvjk0ole1",
"next_possible_start": True,
"intended_start_date": "2024-01-01",
"change_reason": "supplier_change",
"created_by": "john.doe@example.com",
"metadata": {
"utm_source": "google",
"utm_campaign": "campaign_name",
"user_id": "1234567890"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
plan: 'pln_mi4f0oda6x9m7gcsvjk0ole1',
address: {zip: '10115', street: 'Torstraße', city: 'Berlin', house_number: '119'},
meter: {estimated_usage: 2500, type: 'smart', number: '1APA0195124010'},
customer: {
type: 'person',
first_name: 'John',
last_name: 'Doe',
email: 'john.doe@example.com'
},
payment_method: {
type: 'sepa_debit',
sepa_debit: {iban: 'DE68500105178297336485', account_holder: 'John Doe'}
},
previous_supplier: 'mp_mi4f0oda6x9m7gcsvjk0ole1',
next_possible_start: true,
intended_start_date: '2024-01-01',
change_reason: 'supplier_change',
created_by: 'john.doe@example.com',
metadata: {utm_source: 'google', utm_campaign: 'campaign_name', user_id: '1234567890'}
})
};

fetch('https://api.nomos.energy/leads', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nomos.energy/leads",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'plan' => 'pln_mi4f0oda6x9m7gcsvjk0ole1',
'address' => [
'zip' => '10115',
'street' => 'Torstraße',
'city' => 'Berlin',
'house_number' => '119'
],
'meter' => [
'estimated_usage' => 2500,
'type' => 'smart',
'number' => '1APA0195124010'
],
'customer' => [
'type' => 'person',
'first_name' => 'John',
'last_name' => 'Doe',
'email' => 'john.doe@example.com'
],
'payment_method' => [
'type' => 'sepa_debit',
'sepa_debit' => [
'iban' => 'DE68500105178297336485',
'account_holder' => 'John Doe'
]
],
'previous_supplier' => 'mp_mi4f0oda6x9m7gcsvjk0ole1',
'next_possible_start' => true,
'intended_start_date' => '2024-01-01',
'change_reason' => 'supplier_change',
'created_by' => 'john.doe@example.com',
'metadata' => [
'utm_source' => 'google',
'utm_campaign' => 'campaign_name',
'user_id' => '1234567890'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.nomos.energy/leads"

payload := strings.NewReader("{\n \"plan\": \"pln_mi4f0oda6x9m7gcsvjk0ole1\",\n \"address\": {\n \"zip\": \"10115\",\n \"street\": \"Torstraße\",\n \"city\": \"Berlin\",\n \"house_number\": \"119\"\n },\n \"meter\": {\n \"estimated_usage\": 2500,\n \"type\": \"smart\",\n \"number\": \"1APA0195124010\"\n },\n \"customer\": {\n \"type\": \"person\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email\": \"john.doe@example.com\"\n },\n \"payment_method\": {\n \"type\": \"sepa_debit\",\n \"sepa_debit\": {\n \"iban\": \"DE68500105178297336485\",\n \"account_holder\": \"John Doe\"\n }\n },\n \"previous_supplier\": \"mp_mi4f0oda6x9m7gcsvjk0ole1\",\n \"next_possible_start\": true,\n \"intended_start_date\": \"2024-01-01\",\n \"change_reason\": \"supplier_change\",\n \"created_by\": \"john.doe@example.com\",\n \"metadata\": {\n \"utm_source\": \"google\",\n \"utm_campaign\": \"campaign_name\",\n \"user_id\": \"1234567890\"\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.nomos.energy/leads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"plan\": \"pln_mi4f0oda6x9m7gcsvjk0ole1\",\n \"address\": {\n \"zip\": \"10115\",\n \"street\": \"Torstraße\",\n \"city\": \"Berlin\",\n \"house_number\": \"119\"\n },\n \"meter\": {\n \"estimated_usage\": 2500,\n \"type\": \"smart\",\n \"number\": \"1APA0195124010\"\n },\n \"customer\": {\n \"type\": \"person\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email\": \"john.doe@example.com\"\n },\n \"payment_method\": {\n \"type\": \"sepa_debit\",\n \"sepa_debit\": {\n \"iban\": \"DE68500105178297336485\",\n \"account_holder\": \"John Doe\"\n }\n },\n \"previous_supplier\": \"mp_mi4f0oda6x9m7gcsvjk0ole1\",\n \"next_possible_start\": true,\n \"intended_start_date\": \"2024-01-01\",\n \"change_reason\": \"supplier_change\",\n \"created_by\": \"john.doe@example.com\",\n \"metadata\": {\n \"utm_source\": \"google\",\n \"utm_campaign\": \"campaign_name\",\n \"user_id\": \"1234567890\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.nomos.energy/leads")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"plan\": \"pln_mi4f0oda6x9m7gcsvjk0ole1\",\n \"address\": {\n \"zip\": \"10115\",\n \"street\": \"Torstraße\",\n \"city\": \"Berlin\",\n \"house_number\": \"119\"\n },\n \"meter\": {\n \"estimated_usage\": 2500,\n \"type\": \"smart\",\n \"number\": \"1APA0195124010\"\n },\n \"customer\": {\n \"type\": \"person\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email\": \"john.doe@example.com\"\n },\n \"payment_method\": {\n \"type\": \"sepa_debit\",\n \"sepa_debit\": {\n \"iban\": \"DE68500105178297336485\",\n \"account_holder\": \"John Doe\"\n }\n },\n \"previous_supplier\": \"mp_mi4f0oda6x9m7gcsvjk0ole1\",\n \"next_possible_start\": true,\n \"intended_start_date\": \"2024-01-01\",\n \"change_reason\": \"supplier_change\",\n \"created_by\": \"john.doe@example.com\",\n \"metadata\": {\n \"utm_source\": \"google\",\n \"utm_campaign\": \"campaign_name\",\n \"user_id\": \"1234567890\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "object": "lead",
  "id": "lead_a8n8ol7yd4h0wohx824f0bui",
  "link": "https://nomos.checkout.energy/?id=lead_a8n8ol7yd4h0wohx824f0bui",
  "created_at": "2024-03-14T12:00:00Z",
  "subscription": "sub_a8n8ol7yd4h0wohx824f0bui",
  "subscribed_at": "2024-03-14T12:00:00Z",
  "created_by": "john.doe@example.com",
  "last_visited_at": "2024-03-14T12:00:00Z",
  "metadata": {
    "utm_source": "google",
    "utm_campaign": "campaign_name",
    "user_id": "1234567890"
  }
}
{
"code": "BAD_REQUEST",
"message": "invalid_type in 'end': Required",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/BAD_REQUEST"
}
{
"code": "UNAUTHORIZED",
"message": "Invalid or malformed token",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/UNAUTHORIZED"
}
{
"code": "PAYMENT_REQUIRED",
"message": "Payment required",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/PAYMENT_REQUIRED"
}
{
"code": "FORBIDDEN",
"message": "You are not allowed to access this resource",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/FORBIDDEN"
}
{
"code": "NOT_FOUND",
"message": "Resource not found",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/NOT_FOUND"
}
{
"code": "METHOD_NOT_ALLOWED",
"message": "Method not allowed",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/METHOD_NOT_ALLOWED"
}
{
"code": "CONFLICT",
"message": "Resource already exists",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/CONFLICT"
}
{
"code": "UNPROCESSABLE_ENTITY",
"message": "invalid_enum_value in 'status': Invalid enum value. Expected 'pending' | 'active' | 'ended'",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/UNPROCESSABLE_ENTITY"
}
{
"code": "TOO_MANY_REQUESTS",
"message": "Wait 30 seconds before retrying.",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/TOO_MANY_REQUESTS"
}
{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal Server Error",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/INTERNAL_SERVER_ERROR"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

The lead to create

plan
string
required

Plan ID

Example:

"pln_mi4f0oda6x9m7gcsvjk0ole1"

address
object
required
meter
object
required
customer
Person · object
payment_method
object | null
previous_supplier
string | null

ID of the previous supplier, possible to obtain via /suppliers. Only supported for consumption plans.

Example:

"mp_mi4f0oda6x9m7gcsvjk0ole1"

next_possible_start
boolean | null

If set to false we will request the cancellation of the previous supplier / grid operator signup to the date provided in intended_start_date. If set to true we will request the next possible date.

Example:

true

intended_start_date
string<date> | null

Intended start date of the subscription. Must be a date in the future. For feed-in plans it must be the first day of a month, at least one month in the future; when omitted, the next possible production start date is used.

Example:

"2024-01-01"

change_reason
enum<string>

Reason of changing the supplier

Available options:
supplier_change,
move_in
Example:

"supplier_change"

created_by
string | null

Email of the user who created the lead

Example:

"john.doe@example.com"

metadata
object

Metadata of the lead, can be internal data

Example:
{
"utm_source": "google",
"utm_campaign": "campaign_name",
"user_id": "1234567890"
}

Response

The created lead details

object
enum<string>
required
Available options:
lead
id
string
required

Unique identifier for the lead

Example:

"lead_a8n8ol7yd4h0wohx824f0bui"

URL of the lead

Example:

"https://nomos.checkout.energy/?id=lead_a8n8ol7yd4h0wohx824f0bui"

created_at
required

Timestamp when the lead was created

Example:

"2024-03-14T12:00:00Z"

subscription
string | null

ID of the subscription, if the lead is converted to a subscription

Example:

"sub_a8n8ol7yd4h0wohx824f0bui"

subscribed_at

Timestamp when the lead was converted to a subscription

Example:

"2024-03-14T12:00:00Z"

created_by
string | null

Email of the user who created the lead

Example:

"john.doe@example.com"

last_visited_at

Timestamp when the lead was last visited

Example:

"2024-03-14T12:00:00Z"

metadata
object | null

Metadata of the lead, can be internal data

Example:
{
"utm_source": "google",
"utm_campaign": "campaign_name",
"user_id": "1234567890"
}