Publish an offer
Validate an offer against the publish-readiness rules and, if it passes, set its status to active. Returns 400 with structured validationErrors when the offer is not ready to publish.
curl --request POST \
--url https://api.offergrid.io/provider/offers/{id}/publish \
--header 'x-api-key: <api-key>'import requests
url = "https://api.offergrid.io/provider/offers/{id}/publish"
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.offergrid.io/provider/offers/{id}/publish', 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.offergrid.io/provider/offers/{id}/publish",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.offergrid.io/provider/offers/{id}/publish"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-api-key", "<api-key>")
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.offergrid.io/provider/offers/{id}/publish")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.offergrid.io/provider/offers/{id}/publish")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"serviceType": "internet",
"electricity": {
"rate": {
"type": "fixed",
"charges": [
{
"type": "perKwh",
"centsPerKwh": 1,
"owner": "provider",
"label": "<string>",
"minUsageKwh": 1,
"maxUsageKwh": 1
}
],
"avgPriceAt1000Kwh": 1,
"estimatedMonthlyAt1000Kwh": 1
},
"term": {
"length": "no_contract",
"earlyTerminationFee": 1,
"earlyTerminationFeeNotes": "<string>"
},
"plan": {
"renewablePercentage": 50,
"freeNightsWeekends": true,
"noDeposit": true
},
"disclosures": {
"electricityFactsLabel": {
"url": "<string>",
"versionId": "<string>",
"avgPrice500kwh": 1,
"avgPrice1000kwh": 1,
"avgPrice2000kwh": 1,
"renewablePercent": 50
},
"puctCertNumber": "<string>",
"puctCertifiedName": "<string>",
"termsOfServiceUrl": "<string>",
"yourRightsUrl": "<string>"
}
},
"internet": {
"speed": {
"minBandwidthMbps": 1,
"maxBandwidthMbps": 1,
"connectionType": "fiber"
},
"data": {
"capGb": 1
},
"term": {
"length": "no_contract",
"earlyTerminationFee": 1,
"earlyTerminationFeeNotes": "<string>"
},
"disclosures": {
"broadbandLabel": {
"url": "<string>",
"typicalDownload": 1,
"typicalUpload": 1,
"typicalLatency": 1,
"dataCapGb": 1
},
"networkManagementUrl": "<string>"
}
}
}{
"error": "Validation failed",
"message": "Please fix 2 validation issues before publishing.",
"validationErrors": [
{
"section": "pricing",
"field": "monthlyPrice",
"message": "Monthly price is required"
}
],
"sections": {}
}{
"statusCode": 404,
"message": "Offer not found",
"error": "Not Found"
}{
"statusCode": 404,
"message": "Offer not found",
"error": "Not Found"
}{
"statusCode": 404,
"message": "Offer not found",
"error": "Not Found"
}{
"statusCode": 404,
"message": "Offer not found",
"error": "Not Found"
}Authorizations
Team API key for authentication. Your team role (provider/reseller/hybrid) determines which endpoints you can access.
Path Parameters
Response
Offer published (status: active)
An offer. Always includes a top-level serviceType discriminator ("electricity", "internet", …); electricity offers additionally include a grouped electricity object and internet offers a grouped internet object. The underlying offer fields (name, status, markets, marketing, pricing, …) are also present.
Flat service-type discriminator derived from category. Check this instead of category directly.
"internet"
Present only on electricity offers.
Show child attributes
Show child attributes
Present only on internet offers.
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://api.offergrid.io/provider/offers/{id}/publish \
--header 'x-api-key: <api-key>'import requests
url = "https://api.offergrid.io/provider/offers/{id}/publish"
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.offergrid.io/provider/offers/{id}/publish', 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.offergrid.io/provider/offers/{id}/publish",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.offergrid.io/provider/offers/{id}/publish"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-api-key", "<api-key>")
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.offergrid.io/provider/offers/{id}/publish")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.offergrid.io/provider/offers/{id}/publish")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"serviceType": "internet",
"electricity": {
"rate": {
"type": "fixed",
"charges": [
{
"type": "perKwh",
"centsPerKwh": 1,
"owner": "provider",
"label": "<string>",
"minUsageKwh": 1,
"maxUsageKwh": 1
}
],
"avgPriceAt1000Kwh": 1,
"estimatedMonthlyAt1000Kwh": 1
},
"term": {
"length": "no_contract",
"earlyTerminationFee": 1,
"earlyTerminationFeeNotes": "<string>"
},
"plan": {
"renewablePercentage": 50,
"freeNightsWeekends": true,
"noDeposit": true
},
"disclosures": {
"electricityFactsLabel": {
"url": "<string>",
"versionId": "<string>",
"avgPrice500kwh": 1,
"avgPrice1000kwh": 1,
"avgPrice2000kwh": 1,
"renewablePercent": 50
},
"puctCertNumber": "<string>",
"puctCertifiedName": "<string>",
"termsOfServiceUrl": "<string>",
"yourRightsUrl": "<string>"
}
},
"internet": {
"speed": {
"minBandwidthMbps": 1,
"maxBandwidthMbps": 1,
"connectionType": "fiber"
},
"data": {
"capGb": 1
},
"term": {
"length": "no_contract",
"earlyTerminationFee": 1,
"earlyTerminationFeeNotes": "<string>"
},
"disclosures": {
"broadbandLabel": {
"url": "<string>",
"typicalDownload": 1,
"typicalUpload": 1,
"typicalLatency": 1,
"dataCapGb": 1
},
"networkManagementUrl": "<string>"
}
}
}{
"error": "Validation failed",
"message": "Please fix 2 validation issues before publishing.",
"validationErrors": [
{
"section": "pricing",
"field": "monthlyPrice",
"message": "Monthly price is required"
}
],
"sections": {}
}{
"statusCode": 404,
"message": "Offer not found",
"error": "Not Found"
}{
"statusCode": 404,
"message": "Offer not found",
"error": "Not Found"
}{
"statusCode": 404,
"message": "Offer not found",
"error": "Not Found"
}{
"statusCode": 404,
"message": "Offer not found",
"error": "Not Found"
}