curl --request POST \
--url https://api.nomos.energy/oauth/token \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"grant_type": "authorization_code",
"code": "4/P7q7W91a-oMsCeLvIaQm6bTrgtp7",
"refresh_token": "1B4a2e77838347a7E420ce178F2E7c6912E169246c",
"client_id": "client_12345",
"scope": "<string>",
"code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
}
'import requests
url = "https://api.nomos.energy/oauth/token"
payload = {
"grant_type": "authorization_code",
"code": "4/P7q7W91a-oMsCeLvIaQm6bTrgtp7",
"refresh_token": "1B4a2e77838347a7E420ce178F2E7c6912E169246c",
"client_id": "client_12345",
"scope": "<string>",
"code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
grant_type: 'authorization_code',
code: '4/P7q7W91a-oMsCeLvIaQm6bTrgtp7',
refresh_token: '1B4a2e77838347a7E420ce178F2E7c6912E169246c',
client_id: 'client_12345',
scope: '<string>',
code_verifier: 'dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk'
})
};
fetch('https://api.nomos.energy/oauth/token', 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/oauth/token",
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([
'grant_type' => 'authorization_code',
'code' => '4/P7q7W91a-oMsCeLvIaQm6bTrgtp7',
'refresh_token' => '1B4a2e77838347a7E420ce178F2E7c6912E169246c',
'client_id' => 'client_12345',
'scope' => '<string>',
'code_verifier' => 'dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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/oauth/token"
payload := strings.NewReader("{\n \"grant_type\": \"authorization_code\",\n \"code\": \"4/P7q7W91a-oMsCeLvIaQm6bTrgtp7\",\n \"refresh_token\": \"1B4a2e77838347a7E420ce178F2E7c6912E169246c\",\n \"client_id\": \"client_12345\",\n \"scope\": \"<string>\",\n \"code_verifier\": \"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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/oauth/token")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"grant_type\": \"authorization_code\",\n \"code\": \"4/P7q7W91a-oMsCeLvIaQm6bTrgtp7\",\n \"refresh_token\": \"1B4a2e77838347a7E420ce178F2E7c6912E169246c\",\n \"client_id\": \"client_12345\",\n \"scope\": \"<string>\",\n \"code_verifier\": \"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nomos.energy/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"grant_type\": \"authorization_code\",\n \"code\": \"4/P7q7W91a-oMsCeLvIaQm6bTrgtp7\",\n \"refresh_token\": \"1B4a2e77838347a7E420ce178F2E7c6912E169246c\",\n \"client_id\": \"client_12345\",\n \"scope\": \"<string>\",\n \"code_verifier\": \"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlcyI6WyJhZG1pbiJdLCJwYJ0bmVyIjoi...",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "21cc84a3ad98736f4e5eddc88a1f4b58a29ae96206027c9b59d874cb2a7f7e02",
"scope": "read:* write:*"
}{
"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",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"code": "UNAUTHORIZED",
"message": "Invalid or malformed token",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/UNAUTHORIZED",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"code": "PAYMENT_REQUIRED",
"message": "Payment required",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/PAYMENT_REQUIRED",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"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",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"code": "NOT_FOUND",
"message": "Resource not found",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/NOT_FOUND",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"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",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"code": "CONFLICT",
"message": "Resource already exists",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/CONFLICT",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"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",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"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",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"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",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}Create a token
Retrieve a token
curl --request POST \
--url https://api.nomos.energy/oauth/token \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"grant_type": "authorization_code",
"code": "4/P7q7W91a-oMsCeLvIaQm6bTrgtp7",
"refresh_token": "1B4a2e77838347a7E420ce178F2E7c6912E169246c",
"client_id": "client_12345",
"scope": "<string>",
"code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
}
'import requests
url = "https://api.nomos.energy/oauth/token"
payload = {
"grant_type": "authorization_code",
"code": "4/P7q7W91a-oMsCeLvIaQm6bTrgtp7",
"refresh_token": "1B4a2e77838347a7E420ce178F2E7c6912E169246c",
"client_id": "client_12345",
"scope": "<string>",
"code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
grant_type: 'authorization_code',
code: '4/P7q7W91a-oMsCeLvIaQm6bTrgtp7',
refresh_token: '1B4a2e77838347a7E420ce178F2E7c6912E169246c',
client_id: 'client_12345',
scope: '<string>',
code_verifier: 'dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk'
})
};
fetch('https://api.nomos.energy/oauth/token', 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/oauth/token",
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([
'grant_type' => 'authorization_code',
'code' => '4/P7q7W91a-oMsCeLvIaQm6bTrgtp7',
'refresh_token' => '1B4a2e77838347a7E420ce178F2E7c6912E169246c',
'client_id' => 'client_12345',
'scope' => '<string>',
'code_verifier' => 'dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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/oauth/token"
payload := strings.NewReader("{\n \"grant_type\": \"authorization_code\",\n \"code\": \"4/P7q7W91a-oMsCeLvIaQm6bTrgtp7\",\n \"refresh_token\": \"1B4a2e77838347a7E420ce178F2E7c6912E169246c\",\n \"client_id\": \"client_12345\",\n \"scope\": \"<string>\",\n \"code_verifier\": \"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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/oauth/token")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"grant_type\": \"authorization_code\",\n \"code\": \"4/P7q7W91a-oMsCeLvIaQm6bTrgtp7\",\n \"refresh_token\": \"1B4a2e77838347a7E420ce178F2E7c6912E169246c\",\n \"client_id\": \"client_12345\",\n \"scope\": \"<string>\",\n \"code_verifier\": \"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nomos.energy/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"grant_type\": \"authorization_code\",\n \"code\": \"4/P7q7W91a-oMsCeLvIaQm6bTrgtp7\",\n \"refresh_token\": \"1B4a2e77838347a7E420ce178F2E7c6912E169246c\",\n \"client_id\": \"client_12345\",\n \"scope\": \"<string>\",\n \"code_verifier\": \"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlcyI6WyJhZG1pbiJdLCJwYJ0bmVyIjoi...",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "21cc84a3ad98736f4e5eddc88a1f4b58a29ae96206027c9b59d874cb2a7f7e02",
"scope": "read:* write:*"
}{
"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",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"code": "UNAUTHORIZED",
"message": "Invalid or malformed token",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/UNAUTHORIZED",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"code": "PAYMENT_REQUIRED",
"message": "Payment required",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/PAYMENT_REQUIRED",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"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",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"code": "NOT_FOUND",
"message": "Resource not found",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/NOT_FOUND",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"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",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"code": "CONFLICT",
"message": "Resource already exists",
"requestId": "37a04f8f-e791-491c-81e1-86cd304649bb",
"docs": "https://docs.nomos.energy/api-references/errors/CONFLICT",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"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",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"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",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}{
"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",
"errors": [
{
"code": "invalid_type",
"field": "favoriteNumbers.1",
"message": "Invalid input: expected string, received number"
}
]
}Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Body
The token request
The OAuth 2.0 grant type being used for the token request
authorization_code, refresh_token, client_credentials "authorization_code"
The authorization code received from the authorization server (required for authorization_code grant type)
"4/P7q7W91a-oMsCeLvIaQm6bTrgtp7"
The refresh token used to obtain a new access token (required for refresh_token grant type)
"1B4a2e77838347a7E420ce178F2E7c6912E169246c"
The client identifier issued to the client during registration (required for public clients, when not authenticating via Basic Auth)
"client_12345"
PKCE code verifier used to verify the authorization request (required when PKCE was used in authorization request)
"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
Response
Retrieve the quote details
The access token to access the API endpoints
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlcyI6WyJhZG1pbiJdLCJwYJ0bmVyIjoi..."
The type of token issued, always 'Bearer'
Bearer "Bearer"
The lifetime of the access token in seconds (60 minutes)
3600
The refresh token to create a new access_token
"21cc84a3ad98736f4e5eddc88a1f4b58a29ae96206027c9b59d874cb2a7f7e02"
Space-delimited list of scopes granted on this token (RFC 6749).
"read:* write:*"
Was this page helpful?