Add a member to a team
curl --request POST \
--url https://api.planetscale.com/v1/organizations/{organization}/teams/{team}/members \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"user_id": "<string>"
}
'import requests
url = "https://api.planetscale.com/v1/organizations/{organization}/teams/{team}/members"
payload = { "user_id": "<string>" }
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({user_id: '<string>'})
};
fetch('https://api.planetscale.com/v1/organizations/{organization}/teams/{team}/members', 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.planetscale.com/v1/organizations/{organization}/teams/{team}/members",
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([
'user_id' => '<string>'
]),
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://api.planetscale.com/v1/organizations/{organization}/teams/{team}/members"
payload := strings.NewReader("{\n \"user_id\": \"<string>\"\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://api.planetscale.com/v1/organizations/{organization}/teams/{team}/members")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.planetscale.com/v1/organizations/{organization}/teams/{team}/members")
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 \"user_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"user": {
"id": "<string>",
"display_name": "<string>",
"name": "<string>",
"email": "<string>",
"avatar_url": "<string>",
"created_at": "<string>",
"updated_at": "<string>",
"two_factor_auth_configured": true,
"default_organization": {
"id": "<string>",
"name": "<string>",
"created_at": "<string>",
"updated_at": "<string>",
"deleted_at": "<string>"
},
"sso": true,
"managed": true,
"directory_managed": true,
"email_verified": true
},
"actor": {
"id": "<string>",
"display_name": "<string>",
"avatar_url": "<string>"
},
"created_at": "<string>",
"updated_at": "<string>",
"passwords": [
{
"id": "<string>",
"name": "<string>",
"cidrs": [
"<string>"
],
"created_at": "<string>",
"deleted_at": "<string>",
"expires_at": "<string>",
"last_used_at": "<string>",
"expired": true,
"direct_vtgate": true,
"direct_vtgate_addresses": [
"<string>"
],
"ttl_seconds": 123,
"access_host_url": "<string>",
"access_host_regional_url": "<string>",
"access_host_regional_urls": [
"<string>"
],
"actor": {
"id": "<string>",
"display_name": "<string>",
"avatar_url": "<string>"
},
"region": {
"id": "<string>",
"provider": "<string>",
"enabled": true,
"public_ip_addresses": [
"<string>"
],
"display_name": "<string>",
"location": "<string>",
"slug": "<string>",
"current_default": true,
"mysql_supported": true,
"postgresql_supported": true
},
"username": "<string>",
"plain_text": "<string>",
"replica": true,
"renewable": true,
"database_branch": {
"name": "<string>",
"id": "<string>",
"production": true,
"mysql_edge_address": "<string>",
"private_edge_connectivity": true
}
}
]
}Organization teams
Add a member to a team
Authorization
A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:
Service Token Accesses
write_teams
OAuth Scopes
| Resource | Scopes |
|---|---|
| Organization | write_organization |
POST
/
organizations
/
{organization}
/
teams
/
{team}
/
members
Add a member to a team
curl --request POST \
--url https://api.planetscale.com/v1/organizations/{organization}/teams/{team}/members \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"user_id": "<string>"
}
'import requests
url = "https://api.planetscale.com/v1/organizations/{organization}/teams/{team}/members"
payload = { "user_id": "<string>" }
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({user_id: '<string>'})
};
fetch('https://api.planetscale.com/v1/organizations/{organization}/teams/{team}/members', 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.planetscale.com/v1/organizations/{organization}/teams/{team}/members",
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([
'user_id' => '<string>'
]),
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://api.planetscale.com/v1/organizations/{organization}/teams/{team}/members"
payload := strings.NewReader("{\n \"user_id\": \"<string>\"\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://api.planetscale.com/v1/organizations/{organization}/teams/{team}/members")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.planetscale.com/v1/organizations/{organization}/teams/{team}/members")
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 \"user_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"user": {
"id": "<string>",
"display_name": "<string>",
"name": "<string>",
"email": "<string>",
"avatar_url": "<string>",
"created_at": "<string>",
"updated_at": "<string>",
"two_factor_auth_configured": true,
"default_organization": {
"id": "<string>",
"name": "<string>",
"created_at": "<string>",
"updated_at": "<string>",
"deleted_at": "<string>"
},
"sso": true,
"managed": true,
"directory_managed": true,
"email_verified": true
},
"actor": {
"id": "<string>",
"display_name": "<string>",
"avatar_url": "<string>"
},
"created_at": "<string>",
"updated_at": "<string>",
"passwords": [
{
"id": "<string>",
"name": "<string>",
"cidrs": [
"<string>"
],
"created_at": "<string>",
"deleted_at": "<string>",
"expires_at": "<string>",
"last_used_at": "<string>",
"expired": true,
"direct_vtgate": true,
"direct_vtgate_addresses": [
"<string>"
],
"ttl_seconds": 123,
"access_host_url": "<string>",
"access_host_regional_url": "<string>",
"access_host_regional_urls": [
"<string>"
],
"actor": {
"id": "<string>",
"display_name": "<string>",
"avatar_url": "<string>"
},
"region": {
"id": "<string>",
"provider": "<string>",
"enabled": true,
"public_ip_addresses": [
"<string>"
],
"display_name": "<string>",
"location": "<string>",
"slug": "<string>",
"current_default": true,
"mysql_supported": true,
"postgresql_supported": true
},
"username": "<string>",
"plain_text": "<string>",
"replica": true,
"renewable": true,
"database_branch": {
"name": "<string>",
"id": "<string>",
"production": true,
"mysql_edge_address": "<string>",
"private_edge_connectivity": true
}
}
]
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Path Parameters
The name of the organization
The slug of the team
Body
application/json
The ID of the organization member to add to the team
Response
Returns the created team membership
⌘I

