Skip to main content
POST
/
credits
Create a new credit grant
curl --request POST \
  --url https://eu.sequencehq.com/api/credits \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "sequenceAccountId": "dce9ae85-d8d0-42b4-bcad-f221a64363c6",
  "customerId": "61b083e0-1faa-47ca-9aeb-6205da8f6c47",
  "name": "Onboarding Credits",
  "creditUnitType": "CURRENCY",
  "currency": "GBP",
  "metricId": "f092246c-6b90-4106-bcca-304ccf06bf45",
  "amount": 10,
  "costOfCredit": 10,
  "effectiveDate": "2023-01-01",
  "expiryDate": "2023-01-31",
  "createInvoice": true
}
'
import requests

url = "https://eu.sequencehq.com/api/credits"

payload = {
"sequenceAccountId": "dce9ae85-d8d0-42b4-bcad-f221a64363c6",
"customerId": "61b083e0-1faa-47ca-9aeb-6205da8f6c47",
"name": "Onboarding Credits",
"creditUnitType": "CURRENCY",
"currency": "GBP",
"metricId": "f092246c-6b90-4106-bcca-304ccf06bf45",
"amount": 10,
"costOfCredit": 10,
"effectiveDate": "2023-01-01",
"expiryDate": "2023-01-31",
"createInvoice": True
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sequenceAccountId: 'dce9ae85-d8d0-42b4-bcad-f221a64363c6',
customerId: '61b083e0-1faa-47ca-9aeb-6205da8f6c47',
name: 'Onboarding Credits',
creditUnitType: 'CURRENCY',
currency: 'GBP',
metricId: 'f092246c-6b90-4106-bcca-304ccf06bf45',
amount: 10,
costOfCredit: 10,
effectiveDate: '2023-01-01',
expiryDate: '2023-01-31',
createInvoice: true
})
};

fetch('https://eu.sequencehq.com/api/credits', 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://eu.sequencehq.com/api/credits",
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([
'sequenceAccountId' => 'dce9ae85-d8d0-42b4-bcad-f221a64363c6',
'customerId' => '61b083e0-1faa-47ca-9aeb-6205da8f6c47',
'name' => 'Onboarding Credits',
'creditUnitType' => 'CURRENCY',
'currency' => 'GBP',
'metricId' => 'f092246c-6b90-4106-bcca-304ccf06bf45',
'amount' => 10,
'costOfCredit' => 10,
'effectiveDate' => '2023-01-01',
'expiryDate' => '2023-01-31',
'createInvoice' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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://eu.sequencehq.com/api/credits"

payload := strings.NewReader("{\n \"sequenceAccountId\": \"dce9ae85-d8d0-42b4-bcad-f221a64363c6\",\n \"customerId\": \"61b083e0-1faa-47ca-9aeb-6205da8f6c47\",\n \"name\": \"Onboarding Credits\",\n \"creditUnitType\": \"CURRENCY\",\n \"currency\": \"GBP\",\n \"metricId\": \"f092246c-6b90-4106-bcca-304ccf06bf45\",\n \"amount\": 10,\n \"costOfCredit\": 10,\n \"effectiveDate\": \"2023-01-01\",\n \"expiryDate\": \"2023-01-31\",\n \"createInvoice\": true\n}")

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

req.Header.Add("Authorization", "<authorization>")
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://eu.sequencehq.com/api/credits")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"sequenceAccountId\": \"dce9ae85-d8d0-42b4-bcad-f221a64363c6\",\n \"customerId\": \"61b083e0-1faa-47ca-9aeb-6205da8f6c47\",\n \"name\": \"Onboarding Credits\",\n \"creditUnitType\": \"CURRENCY\",\n \"currency\": \"GBP\",\n \"metricId\": \"f092246c-6b90-4106-bcca-304ccf06bf45\",\n \"amount\": 10,\n \"costOfCredit\": 10,\n \"effectiveDate\": \"2023-01-01\",\n \"expiryDate\": \"2023-01-31\",\n \"createInvoice\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://eu.sequencehq.com/api/credits")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sequenceAccountId\": \"dce9ae85-d8d0-42b4-bcad-f221a64363c6\",\n \"customerId\": \"61b083e0-1faa-47ca-9aeb-6205da8f6c47\",\n \"name\": \"Onboarding Credits\",\n \"creditUnitType\": \"CURRENCY\",\n \"currency\": \"GBP\",\n \"metricId\": \"f092246c-6b90-4106-bcca-304ccf06bf45\",\n \"amount\": 10,\n \"costOfCredit\": 10,\n \"effectiveDate\": \"2023-01-01\",\n \"expiryDate\": \"2023-01-31\",\n \"createInvoice\": true\n}"

response = http.request(request)
puts response.read_body
{
  "id": "746fc7f2-8098-4fe7-953c-7d51c580a126",
  "sequenceAccountId": "dce9ae85-d8d0-42b4-bcad-f221a64363c6",
  "customerId": "61b083e0-1faa-47ca-9aeb-6205da8f6c47",
  "name": "Onboarding Credits",
  "creditUnitType": "CURRENCY",
  "currency": "GBP",
  "metricId": "f092246c-6b90-4106-bcca-304ccf06bf45",
  "amount": 10,
  "costOfCredit": 10,
  "effectiveDate": "2023-01-01",
  "expiryDate": "2023-01-31",
  "createdAt": "2022-10-07T14:12:08.826121Z",
  "integrationIds": [
    {
      "service": "Xero",
      "id": "74ed2615-4730-49ab-9445-74f31723a206",
      "isPending": false
    }
  ]
}
This response has no body data.
This response has no body data.
This response has no body data.

Headers

Authorization
string
required

Your API credentials. Eg. Basic {credentials}.

sequence-version
enum<string>

Use this header to select an API version

Available options:
2024-07-30

Body

application/json
sequenceAccountId
string
required

Sequence account ID

Example:

"dce9ae85-d8d0-42b4-bcad-f221a64363c6"

customerId
string
required

The ID of the customer credit is granted to

Example:

"61b083e0-1faa-47ca-9aeb-6205da8f6c47"

name
string
required

Name of the credit grant

Example:

"Onboarding Credits"

creditUnitType
enum<string>
required

Type of the unit of credit

Available options:
CURRENCY,
METRIC
Example:

"CURRENCY"

currency
enum<string>
required

Currency of cash credit (if creditUnitType is CURRENCY)

Available options:
AED,
ARS,
AUD,
BRL,
BGN,
CAD,
CHF,
CLP,
CNY,
COP,
CZK,
DKK,
EGP,
EUR,
GBP,
HKD,
ILS,
INR,
ISK,
JPY,
KRW,
MXN,
NOK,
NZD,
PLN,
SAR,
SEK,
SGD,
THB,
USD,
UYU,
ZAR
Example:

"GBP"

amount
number
required

Amount of units granted

Example:

10

metricId
string

Metric ID (if creditUnitType is METRIC)

Example:

"f092246c-6b90-4106-bcca-304ccf06bf45"

costOfCredit
number

Cost of credit grant, to be invoiced to the customer

Example:

10

effectiveDate
string

First day credit grant can be consumed

Example:

"2023-01-01"

expiryDate
string

Last day credit grant can be consumed

Example:

"2023-01-31"

createInvoice
boolean

If true we will create an invoice to charge the customer for this grant

Example:

true

Response

Created

id
string
required

Credit grant ID

Example:

"746fc7f2-8098-4fe7-953c-7d51c580a126"

sequenceAccountId
string
required

Sequence account ID

Example:

"dce9ae85-d8d0-42b4-bcad-f221a64363c6"

customerId
string
required

The ID of the customer credit is granted to

Example:

"61b083e0-1faa-47ca-9aeb-6205da8f6c47"

name
string
required

Name of the credit grant

Example:

"Onboarding Credits"

creditUnitType
enum<string>
required

Type of the unit of credit

Available options:
CURRENCY,
METRIC
Example:

"CURRENCY"

amount
number
required

Amount of units granted

Example:

10

createdAt
string
required

The creation timestamp

Example:

"2022-10-07T14:12:08.826121Z"

integrationIds
object[]
required

IDs in external integrations

Example:
[
{
"service": "Xero",
"id": "74ed2615-4730-49ab-9445-74f31723a206",
"isPending": false
}
]
currency
enum<string>

Currency of cash credit (if creditUnitType is CURRENCY)

Available options:
AED,
ARS,
AUD,
BRL,
BGN,
CAD,
CHF,
CLP,
CNY,
COP,
CZK,
DKK,
EGP,
EUR,
GBP,
HKD,
ILS,
INR,
ISK,
JPY,
KRW,
MXN,
NOK,
NZD,
PLN,
SAR,
SEK,
SGD,
THB,
USD,
UYU,
ZAR
Example:

"GBP"

metricId
string

Metric ID (if creditUnitType is METRIC)

Example:

"f092246c-6b90-4106-bcca-304ccf06bf45"

costOfCredit
number

Cost of credit grant, to be invoiced to the customer

Example:

10

effectiveDate
string

First day credit grant can be consumed

Example:

"2023-01-01"

expiryDate
string

Last day credit grant can be consumed

Example:

"2023-01-31"