Skip to main content
POST
/
account-invitations
Create account invitation
curl --request POST \
  --url https://cookiechimp.com/api/v1/account-invitations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "email": "jsmith@example.com"
}
'
import requests

url = "https://cookiechimp.com/api/v1/account-invitations"

payload = {
"name": "<string>",
"email": "jsmith@example.com"
}
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({name: '<string>', email: 'jsmith@example.com'})
};

fetch('https://cookiechimp.com/api/v1/account-invitations', 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://cookiechimp.com/api/v1/account-invitations",
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([
'name' => '<string>',
'email' => 'jsmith@example.com'
]),
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://cookiechimp.com/api/v1/account-invitations"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\"\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://cookiechimp.com/api/v1/account-invitations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://cookiechimp.com/api/v1/account-invitations")

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 \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "inv123",
  "email": "newmember@cookiechimp.com",
  "role": "member",
  "invited_by_type": "API",
  "created_at": "2023-01-25T09:30:20Z",
  "updated_at": "2023-01-25T09:30:20Z"
}
{
"error": {
"code": 400,
"message": "Invalid request"
}
}

Authorizations

Authorization
string
header
required

API token obtained from the login endpoint or the dashboard

Body

application/json

Account invitation to create

name
string
required

Name of the user the invitation is for

email
string<email>
required

Email address of the user

role
enum<string>
required

Role of the user when they accept the invitation

Available options:
admin,
member

Response

Created account invitation

name
string
required

Name of the user the invitation is for

email
string<email>
required

Email address of the user

role
enum<string>
required

Role of the user when they accept the invitation

Available options:
admin,
member
id
string
invited_by_type
string

Type of entity that created the invitation (account_user or API)

invited_by_id
string | null

ID of the user who created the invitation

created_at
string<date-time>

Date and time when the invitation was created

updated_at
string<date-time>

Date and time when the invitation was last updated

deleted_at
string<date-time>

Date and time when the invitation was cancelled