Skip to main content
PUT
/
v1
/
members
/
{id}
cURL
curl --request PUT \
  --url https://api.onsi.com/v1/members/{id} \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "email": "jane-smith@onsi.com",
  "firstName": "John",
  "lastName": "Smith",
  "tier": "Gold",
  "phone": "+447123456789",
  "workerId": "ID_123",
  "accountDetails": {
    "accountHolder": "John Smith",
    "sortCode": "123456",
    "accountNumber": "12345678"
  },
  "enablePayroll": true,
  "dob": "1990-01-01"
}
'
import requests

url = "https://api.onsi.com/v1/members/{id}"

payload = {
"email": "jane-smith@onsi.com",
"firstName": "John",
"lastName": "Smith",
"tier": "Gold",
"phone": "+447123456789",
"workerId": "ID_123",
"accountDetails": {
"accountHolder": "John Smith",
"sortCode": "123456",
"accountNumber": "12345678"
},
"enablePayroll": True,
"dob": "1990-01-01"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'PUT',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'jane-smith@onsi.com',
firstName: 'John',
lastName: 'Smith',
tier: 'Gold',
phone: '+447123456789',
workerId: 'ID_123',
accountDetails: {accountHolder: 'John Smith', sortCode: '123456', accountNumber: '12345678'},
enablePayroll: true,
dob: '1990-01-01'
})
};

fetch('https://api.onsi.com/v1/members/{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://api.onsi.com/v1/members/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'jane-smith@onsi.com',
'firstName' => 'John',
'lastName' => 'Smith',
'tier' => 'Gold',
'phone' => '+447123456789',
'workerId' => 'ID_123',
'accountDetails' => [
'accountHolder' => 'John Smith',
'sortCode' => '123456',
'accountNumber' => '12345678'
],
'enablePayroll' => true,
'dob' => '1990-01-01'
]),
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://api.onsi.com/v1/members/{id}"

payload := strings.NewReader("{\n \"email\": \"jane-smith@onsi.com\",\n \"firstName\": \"John\",\n \"lastName\": \"Smith\",\n \"tier\": \"Gold\",\n \"phone\": \"+447123456789\",\n \"workerId\": \"ID_123\",\n \"accountDetails\": {\n \"accountHolder\": \"John Smith\",\n \"sortCode\": \"123456\",\n \"accountNumber\": \"12345678\"\n },\n \"enablePayroll\": true,\n \"dob\": \"1990-01-01\"\n}")

req, _ := http.NewRequest("PUT", 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.put("https://api.onsi.com/v1/members/{id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jane-smith@onsi.com\",\n \"firstName\": \"John\",\n \"lastName\": \"Smith\",\n \"tier\": \"Gold\",\n \"phone\": \"+447123456789\",\n \"workerId\": \"ID_123\",\n \"accountDetails\": {\n \"accountHolder\": \"John Smith\",\n \"sortCode\": \"123456\",\n \"accountNumber\": \"12345678\"\n },\n \"enablePayroll\": true,\n \"dob\": \"1990-01-01\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.onsi.com/v1/members/{id}")

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

request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"jane-smith@onsi.com\",\n \"firstName\": \"John\",\n \"lastName\": \"Smith\",\n \"tier\": \"Gold\",\n \"phone\": \"+447123456789\",\n \"workerId\": \"ID_123\",\n \"accountDetails\": {\n \"accountHolder\": \"John Smith\",\n \"sortCode\": \"123456\",\n \"accountNumber\": \"12345678\"\n },\n \"enablePayroll\": true,\n \"dob\": \"1990-01-01\"\n}"

response = http.request(request)
puts response.read_body
{
  "email": "jsmith@example.com",
  "memberId": "mem_q5sdae3se6eg9m9dcvug",
  "firstName": "John",
  "lastName": "Smith",
  "phone": "+447123456789",
  "tier": "Gold",
  "workerId": "ID_123",
  "accountDetails": {
    "accountHolder": "John Smith",
    "sortCode": "123456",
    "accountNumber": "12345678"
  },
  "enablePayroll": true,
  "dob": "1990-01-01"
}
Replacing an existing member, identified by their memberId. As you’re providing the entire desired member state, members with a status of inactive will be re-activated on your Onsi programme.

Unsetting Bank Details

To remove a member’s bank details, set accountDetails to null.

Relevant Error Codes

If there are any issues with the member replace, the API will return a 400 status code with the following error codes:

Authorizations

x-api-key
string
header
required

Headers

x-idempotency-key
string

Unique key to ensure idempotency of the request

Path Parameters

id
string
required

The unique identifier for a Member, prefixed with mem_

Example:

"mem_<id>"

Body

application/json

Body

email
string<email>
required

A unique email address for the member

Pattern: ^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$
Example:

"jane-smith@onsi.com"

firstName
string
required
Example:

"John"

lastName
string
required
Example:

"Smith"

tier
string
required

Tier name for the member

Example:

"Gold"

phone
string

An optional phone number for the member

Example:

"+447123456789"

workerId
string

Unique ID provided by API consumer, must be unique across all members (active, invited and inactive)

Example:

"ID_123"

accountDetails
BankAccountUK · object

A UK bank account

Example:
{
"accountHolder": "John Smith",
"sortCode": "123456",
"accountNumber": "12345678"
}
enablePayroll
boolean
dob
string

Date of birth of the member, must later than 1900

Pattern: ^\d{4}-\d{2}-\d{2}$
Example:

"1990-01-01"

gender
enum<string> | null

Gender of the member

Available options:
Female,
Male,
NonBinary

Response

200 - application/json

A member on the platform.

A member on the platform.

email
string<email>
required
Pattern: ^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$
memberId
string
required

Onsi's ID of the member

Example:

"mem_q5sdae3se6eg9m9dcvug"

firstName
string
required
Example:

"John"

lastName
string
required
Example:

"Smith"

phone
string | null
required
Example:

"+447123456789"

tier
string
required

Tier name for the member

Example:

"Gold"

workerId
string | null
required

Unique ID provided by API consumer, must be unique across all members (active, invited and inactive)

Example:

"ID_123"

status
enum<string>
required

The status of the member.

Available options:
active,
invited,
inactive
accountDetails
BankAccountUK · object
required

A UK bank account

Example:
{
"accountHolder": "John Smith",
"sortCode": "123456",
"accountNumber": "12345678"
}
enablePayroll
boolean
required
Example:

true

dob
string | null
required

Date of birth of the member, must later than 1900

Pattern: ^\d{4}-\d{2}-\d{2}$
Example:

"1990-01-01"

gender
enum<string> | null

Gender of the member

Available options:
Female,
Male,
NonBinary