Create Connection Invitation
curl --request POST \
--url https://external.nectarclimate.com/v2.2/invitation/company/{company_id} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"allowedEmails": [
"jsmith@example.com"
],
"expiresInSeconds": 61,
"maxUses": 2,
"sendEmail": false,
"prefill": {
"datasourceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"initialSites": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"utilityTypes": [],
"connectionOwnerEmail": "jsmith@example.com",
"dataCollectionStartDate": "2023-12-25",
"externalId": "<string>"
}
}
'import requests
url = "https://external.nectarclimate.com/v2.2/invitation/company/{company_id}"
payload = {
"allowedEmails": ["jsmith@example.com"],
"expiresInSeconds": 61,
"maxUses": 2,
"sendEmail": False,
"prefill": {
"datasourceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"initialSites": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"utilityTypes": [],
"connectionOwnerEmail": "jsmith@example.com",
"dataCollectionStartDate": "2023-12-25",
"externalId": "<string>"
}
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
allowedEmails: ['jsmith@example.com'],
expiresInSeconds: 61,
maxUses: 2,
sendEmail: false,
prefill: {
datasourceId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
url: '<string>',
initialSites: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
utilityTypes: [],
connectionOwnerEmail: 'jsmith@example.com',
dataCollectionStartDate: '2023-12-25',
externalId: '<string>'
}
})
};
fetch('https://external.nectarclimate.com/v2.2/invitation/company/{company_id}', 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://external.nectarclimate.com/v2.2/invitation/company/{company_id}",
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([
'allowedEmails' => [
'jsmith@example.com'
],
'expiresInSeconds' => 61,
'maxUses' => 2,
'sendEmail' => false,
'prefill' => [
'datasourceId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'url' => '<string>',
'initialSites' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'utilityTypes' => [
],
'connectionOwnerEmail' => 'jsmith@example.com',
'dataCollectionStartDate' => '2023-12-25',
'externalId' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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://external.nectarclimate.com/v2.2/invitation/company/{company_id}"
payload := strings.NewReader("{\n \"allowedEmails\": [\n \"jsmith@example.com\"\n ],\n \"expiresInSeconds\": 61,\n \"maxUses\": 2,\n \"sendEmail\": false,\n \"prefill\": {\n \"datasourceId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"url\": \"<string>\",\n \"initialSites\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"utilityTypes\": [],\n \"connectionOwnerEmail\": \"jsmith@example.com\",\n \"dataCollectionStartDate\": \"2023-12-25\",\n \"externalId\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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://external.nectarclimate.com/v2.2/invitation/company/{company_id}")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"allowedEmails\": [\n \"jsmith@example.com\"\n ],\n \"expiresInSeconds\": 61,\n \"maxUses\": 2,\n \"sendEmail\": false,\n \"prefill\": {\n \"datasourceId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"url\": \"<string>\",\n \"initialSites\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"utilityTypes\": [],\n \"connectionOwnerEmail\": \"jsmith@example.com\",\n \"dataCollectionStartDate\": \"2023-12-25\",\n \"externalId\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://external.nectarclimate.com/v2.2/invitation/company/{company_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"allowedEmails\": [\n \"jsmith@example.com\"\n ],\n \"expiresInSeconds\": 61,\n \"maxUses\": 2,\n \"sendEmail\": false,\n \"prefill\": {\n \"datasourceId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"url\": \"<string>\",\n \"initialSites\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"utilityTypes\": [],\n \"connectionOwnerEmail\": \"jsmith@example.com\",\n \"dataCollectionStartDate\": \"2023-12-25\",\n \"externalId\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"token": "<string>",
"invitationType": "<string>",
"status": "<string>",
"invitationUrl": "<string>",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"allowedEmails": [
"jsmith@example.com"
],
"expiresAt": "2023-11-07T05:31:56Z",
"maxUses": 123,
"useCount": 123,
"created": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"prefill": {
"datasourceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"initialSites": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"utilityTypes": [
"ELECTRICITY"
],
"country": "AF",
"connectionOwnerEmail": "jsmith@example.com",
"dataCollectionStartDate": "2023-12-25",
"externalId": "<string>"
},
"createdConnections": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"datasourceName": "<string>",
"status": "<string>",
"created": "2023-11-07T05:31:56Z"
}
]
}Invitations
Create Connection Invitation
Create an invitation that lets an external contributor connect a new utility account to the specified company. The response includes an invitationUrl to send to the contributor. Supports optional email restrictions, expiration, usage limits, and pre-filled form data.
POST
/
invitation
/
company
/
{company_id}
Create Connection Invitation
curl --request POST \
--url https://external.nectarclimate.com/v2.2/invitation/company/{company_id} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"allowedEmails": [
"jsmith@example.com"
],
"expiresInSeconds": 61,
"maxUses": 2,
"sendEmail": false,
"prefill": {
"datasourceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"initialSites": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"utilityTypes": [],
"connectionOwnerEmail": "jsmith@example.com",
"dataCollectionStartDate": "2023-12-25",
"externalId": "<string>"
}
}
'import requests
url = "https://external.nectarclimate.com/v2.2/invitation/company/{company_id}"
payload = {
"allowedEmails": ["jsmith@example.com"],
"expiresInSeconds": 61,
"maxUses": 2,
"sendEmail": False,
"prefill": {
"datasourceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"initialSites": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"utilityTypes": [],
"connectionOwnerEmail": "jsmith@example.com",
"dataCollectionStartDate": "2023-12-25",
"externalId": "<string>"
}
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
allowedEmails: ['jsmith@example.com'],
expiresInSeconds: 61,
maxUses: 2,
sendEmail: false,
prefill: {
datasourceId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
url: '<string>',
initialSites: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
utilityTypes: [],
connectionOwnerEmail: 'jsmith@example.com',
dataCollectionStartDate: '2023-12-25',
externalId: '<string>'
}
})
};
fetch('https://external.nectarclimate.com/v2.2/invitation/company/{company_id}', 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://external.nectarclimate.com/v2.2/invitation/company/{company_id}",
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([
'allowedEmails' => [
'jsmith@example.com'
],
'expiresInSeconds' => 61,
'maxUses' => 2,
'sendEmail' => false,
'prefill' => [
'datasourceId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'url' => '<string>',
'initialSites' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'utilityTypes' => [
],
'connectionOwnerEmail' => 'jsmith@example.com',
'dataCollectionStartDate' => '2023-12-25',
'externalId' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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://external.nectarclimate.com/v2.2/invitation/company/{company_id}"
payload := strings.NewReader("{\n \"allowedEmails\": [\n \"jsmith@example.com\"\n ],\n \"expiresInSeconds\": 61,\n \"maxUses\": 2,\n \"sendEmail\": false,\n \"prefill\": {\n \"datasourceId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"url\": \"<string>\",\n \"initialSites\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"utilityTypes\": [],\n \"connectionOwnerEmail\": \"jsmith@example.com\",\n \"dataCollectionStartDate\": \"2023-12-25\",\n \"externalId\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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://external.nectarclimate.com/v2.2/invitation/company/{company_id}")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"allowedEmails\": [\n \"jsmith@example.com\"\n ],\n \"expiresInSeconds\": 61,\n \"maxUses\": 2,\n \"sendEmail\": false,\n \"prefill\": {\n \"datasourceId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"url\": \"<string>\",\n \"initialSites\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"utilityTypes\": [],\n \"connectionOwnerEmail\": \"jsmith@example.com\",\n \"dataCollectionStartDate\": \"2023-12-25\",\n \"externalId\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://external.nectarclimate.com/v2.2/invitation/company/{company_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"allowedEmails\": [\n \"jsmith@example.com\"\n ],\n \"expiresInSeconds\": 61,\n \"maxUses\": 2,\n \"sendEmail\": false,\n \"prefill\": {\n \"datasourceId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"url\": \"<string>\",\n \"initialSites\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"utilityTypes\": [],\n \"connectionOwnerEmail\": \"jsmith@example.com\",\n \"dataCollectionStartDate\": \"2023-12-25\",\n \"externalId\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"token": "<string>",
"invitationType": "<string>",
"status": "<string>",
"invitationUrl": "<string>",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"allowedEmails": [
"jsmith@example.com"
],
"expiresAt": "2023-11-07T05:31:56Z",
"maxUses": 123,
"useCount": 123,
"created": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"prefill": {
"datasourceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"url": "<string>",
"initialSites": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"utilityTypes": [
"ELECTRICITY"
],
"country": "AF",
"connectionOwnerEmail": "jsmith@example.com",
"dataCollectionStartDate": "2023-12-25",
"externalId": "<string>"
},
"createdConnections": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"datasourceName": "<string>",
"status": "<string>",
"created": "2023-11-07T05:31:56Z"
}
]
}Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Request body for creating an invitation that lets an external contributor connect a utility account.
Response
An invitation that grants an external contributor access to create or update a connection.