export const title = 'MSP'
## Get MSP tenants {{ tag: 'GET' , label: '/api/integrations/msp/tenants' }}
```bash {{ title: 'cURL' }}
curl -X GET https://api.netbird.io/api/integrations/msp/tenants \
-H 'Accept: application/json' \
-H 'Authorization: Token '
```
```js
const axios = require('axios');
let config = {
method: 'get',
maxBodyLength: Infinity,
url: '/api/integrations/msp/tenants',
headers: {
'Accept': 'application/json',
'Authorization': 'Token '
}
};
axios(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
```
```python
import requests
import json
url = "https://api.netbird.io/api/integrations/msp/tenants"
headers = {
'Accept': 'application/json',
'Authorization': 'Token '
}
response = requests.request("GET", url, headers=headers)
print(response.text)
```
```go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.netbird.io/api/integrations/msp/tenants"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Token ")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
```
```ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.netbird.io/api/integrations/msp/tenants")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Accept"] = "application/json"
request["Authorization"] = "Token "
response = https.request(request)
puts response.read_body
```
```java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://api.netbird.io/api/integrations/msp/tenants")
.method("GET")
.addHeader("Accept", "application/json")
.addHeader("Authorization: Token ")
.build();
Response response = client.newCall(request).execute();
```
```php
'https://api.netbird.io/api/integrations/msp/tenants',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Authorization: Token '
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```
```json {{ title: 'Example' }}
[
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "My new tenant",
"domain": "tenant.com",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
],
"activated_at": "2021-08-01T12:00:00Z",
"dns_challenge": "YXNkYSBkYXNhc2Rhc2RhIGFzZGFzZDJhc2QyNDUxNQ",
"created_at": "2021-08-01T12:00:00Z",
"updated_at": "2021-08-01T12:00:00Z",
"invited_at": "2021-08-01T12:00:00Z",
"status": "active"
}
]
```
```json {{ title: 'Schema' }}
[
{
"id": "string",
"name": "string",
"domain": "string",
"groups": [
{
"id": "string",
"role": "string"
}
],
"activated_at": "string",
"dns_challenge": "string",
"created_at": "string",
"updated_at": "string",
"invited_at": "string",
"status": "string"
}
]
```
---
## Create MSP tenant {{ tag: 'POST' , label: '/api/integrations/msp/tenants' }}
### Request-Body Parameters
The name for the MSP tenant
The name for the MSP tenant
MSP users Groups that can access the Tenant and Roles to assume
The Group ID
The Role name
```bash {{ title: 'cURL' }}
curl -X POST https://api.netbird.io/api/integrations/msp/tenants \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Token ' \
--data-raw '{
"name": "My new tenant",
"domain": "tenant.com",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
]
}'
```
```js
const axios = require('axios');
let data = JSON.stringify({
"name": "My new tenant",
"domain": "tenant.com",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
]
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: '/api/integrations/msp/tenants',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Token '
},
data : data
};
axios(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
```
```python
import requests
import json
url = "https://api.netbird.io/api/integrations/msp/tenants"
payload = json.dumps({
"name": "My new tenant",
"domain": "tenant.com",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
]
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Token '
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
```
```go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.netbird.io/api/integrations/msp/tenants"
method := "POST"
payload := strings.NewReader(`{
"name": "My new tenant",
"domain": "tenant.com",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
]
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Token ")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
```
```ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.netbird.io/api/integrations/msp/tenants")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request["Authorization"] = "Token "
request.body = JSON.dump({
"name": "My new tenant",
"domain": "tenant.com",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
]
})
response = https.request(request)
puts response.read_body
```
```java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, '{
"name": "My new tenant",
"domain": "tenant.com",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
]
}');
Request request = new Request.Builder()
.url("https://api.netbird.io/api/integrations/msp/tenants")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("Authorization: Token ")
.build();
Response response = client.newCall(request).execute();
```
```php
'https://api.netbird.io/api/integrations/msp/tenants',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"name": "My new tenant",
"domain": "tenant.com",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
]
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Accept: application/json',
'Authorization: Token '
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```
```json {{ title: 'Example' }}
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "My new tenant",
"domain": "tenant.com",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
],
"activated_at": "2021-08-01T12:00:00Z",
"dns_challenge": "YXNkYSBkYXNhc2Rhc2RhIGFzZGFzZDJhc2QyNDUxNQ",
"created_at": "2021-08-01T12:00:00Z",
"updated_at": "2021-08-01T12:00:00Z",
"invited_at": "2021-08-01T12:00:00Z",
"status": "active"
}
```
```json {{ title: 'Schema' }}
{
"id": "string",
"name": "string",
"domain": "string",
"groups": [
{
"id": "string",
"role": "string"
}
],
"activated_at": "string",
"dns_challenge": "string",
"created_at": "string",
"updated_at": "string",
"invited_at": "string",
"status": "string"
}
```
---
## Update MSP tenant {{ tag: 'PUT' , label: '/api/integrations/msp/tenants/{id}' }}
### Path Parameters
The unique identifier of a tenant account
### Request-Body Parameters
The name for the MSP tenant
MSP users Groups that can access the Tenant and Roles to assume
The Group ID
The Role name
```bash {{ title: 'cURL' }}
curl -X PUT https://api.netbird.io/api/integrations/msp/tenants/{id} \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Token ' \
--data-raw '{
"name": "My new tenant",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
]
}'
```
```js
const axios = require('axios');
let data = JSON.stringify({
"name": "My new tenant",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
]
});
let config = {
method: 'put',
maxBodyLength: Infinity,
url: '/api/integrations/msp/tenants/{id}',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Token '
},
data : data
};
axios(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
```
```python
import requests
import json
url = "https://api.netbird.io/api/integrations/msp/tenants/{id}"
payload = json.dumps({
"name": "My new tenant",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
]
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Token '
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
```
```go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.netbird.io/api/integrations/msp/tenants/{id}"
method := "PUT"
payload := strings.NewReader(`{
"name": "My new tenant",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
]
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Token ")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
```
```ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.netbird.io/api/integrations/msp/tenants/{id}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request["Authorization"] = "Token "
request.body = JSON.dump({
"name": "My new tenant",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
]
})
response = https.request(request)
puts response.read_body
```
```java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, '{
"name": "My new tenant",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
]
}');
Request request = new Request.Builder()
.url("https://api.netbird.io/api/integrations/msp/tenants/{id}")
.method("PUT", body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("Authorization: Token ")
.build();
Response response = client.newCall(request).execute();
```
```php
'https://api.netbird.io/api/integrations/msp/tenants/{id}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS => '{
"name": "My new tenant",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
]
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Accept: application/json',
'Authorization: Token '
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```
```json {{ title: 'Example' }}
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "My new tenant",
"domain": "tenant.com",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
],
"activated_at": "2021-08-01T12:00:00Z",
"dns_challenge": "YXNkYSBkYXNhc2Rhc2RhIGFzZGFzZDJhc2QyNDUxNQ",
"created_at": "2021-08-01T12:00:00Z",
"updated_at": "2021-08-01T12:00:00Z",
"invited_at": "2021-08-01T12:00:00Z",
"status": "active"
}
```
```json {{ title: 'Schema' }}
{
"id": "string",
"name": "string",
"domain": "string",
"groups": [
{
"id": "string",
"role": "string"
}
],
"activated_at": "string",
"dns_challenge": "string",
"created_at": "string",
"updated_at": "string",
"invited_at": "string",
"status": "string"
}
```
---
## Delete MSP tenant {{ tag: 'DELETE' , label: '/api/integrations/msp/tenants/{id}' }}
### Path Parameters
The unique identifier of a tenant account
```bash {{ title: 'cURL' }}
curl -X DELETE https://api.netbird.io/api/integrations/msp/tenants/{id} \
-H 'Authorization: Token '
```
```js
const axios = require('axios');
let config = {
method: 'delete',
maxBodyLength: Infinity,
url: '/api/integrations/msp/tenants/{id}',
headers: {
'Authorization': 'Token '
}
};
axios(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
```
```python
import requests
import json
url = "https://api.netbird.io/api/integrations/msp/tenants/{id}"
headers = {
'Authorization': 'Token '
}
response = requests.request("DELETE", url, headers=headers)
print(response.text)
```
```go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.netbird.io/api/integrations/msp/tenants/{id}"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Token ")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
```
```ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.netbird.io/api/integrations/msp/tenants/{id}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = "Token "
response = https.request(request)
puts response.read_body
```
```java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://api.netbird.io/api/integrations/msp/tenants/{id}")
.method("DELETE")
.addHeader("Authorization: Token ")
.build();
Response response = client.newCall(request).execute();
```
```php
'https://api.netbird.io/api/integrations/msp/tenants/{id}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => array(
'Authorization: Token '
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```
---
## Unlink a tenant {{ tag: 'POST' , label: '/api/integrations/msp/tenants/{id}/unlink' }}
### Path Parameters
The unique identifier of a tenant account
### Request-Body Parameters
The new owners user ID.
```bash {{ title: 'cURL' }}
curl -X POST https://api.netbird.io/api/integrations/msp/tenants/{id}/unlink \
-H 'Content-Type: application/json' \
-H 'Authorization: Token ' \
--data-raw '{
"owner": "google-oauth2|123456789012345678901"
}'
```
```js
const axios = require('axios');
let data = JSON.stringify({
"owner": "google-oauth2|123456789012345678901"
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: '/api/integrations/msp/tenants/{id}/unlink',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Token '
},
data : data
};
axios(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
```
```python
import requests
import json
url = "https://api.netbird.io/api/integrations/msp/tenants/{id}/unlink"
payload = json.dumps({
"owner": "google-oauth2|123456789012345678901"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Token '
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
```
```go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.netbird.io/api/integrations/msp/tenants/{id}/unlink"
method := "POST"
payload := strings.NewReader(`{
"owner": "google-oauth2|123456789012345678901"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Token ")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
```
```ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.netbird.io/api/integrations/msp/tenants/{id}/unlink")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Token "
request.body = JSON.dump({
"owner": "google-oauth2|123456789012345678901"
})
response = https.request(request)
puts response.read_body
```
```java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, '{
"owner": "google-oauth2|123456789012345678901"
}');
Request request = new Request.Builder()
.url("https://api.netbird.io/api/integrations/msp/tenants/{id}/unlink")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization: Token ")
.build();
Response response = client.newCall(request).execute();
```
```php
'https://api.netbird.io/api/integrations/msp/tenants/{id}/unlink',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"owner": "google-oauth2|123456789012345678901"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Token '
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```
---
## Verify a tenant domain DNS challenge {{ tag: 'POST' , label: '/api/integrations/msp/tenants/{id}/dns' }}
### Path Parameters
The unique identifier of a tenant account
```bash {{ title: 'cURL' }}
curl -X POST https://api.netbird.io/api/integrations/msp/tenants/{id}/dns \
-H 'Authorization: Token '
```
```js
const axios = require('axios');
let config = {
method: 'post',
maxBodyLength: Infinity,
url: '/api/integrations/msp/tenants/{id}/dns',
headers: {
'Authorization': 'Token '
}
};
axios(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
```
```python
import requests
import json
url = "https://api.netbird.io/api/integrations/msp/tenants/{id}/dns"
headers = {
'Authorization': 'Token '
}
response = requests.request("POST", url, headers=headers)
print(response.text)
```
```go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.netbird.io/api/integrations/msp/tenants/{id}/dns"
method := "POST"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Token ")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
```
```ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.netbird.io/api/integrations/msp/tenants/{id}/dns")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Token "
response = https.request(request)
puts response.read_body
```
```java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://api.netbird.io/api/integrations/msp/tenants/{id}/dns")
.method("POST")
.addHeader("Authorization: Token ")
.build();
Response response = client.newCall(request).execute();
```
```php
'https://api.netbird.io/api/integrations/msp/tenants/{id}/dns',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => array(
'Authorization: Token '
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```
---
## Create subscription for Tenant {{ tag: 'POST' , label: '/api/integrations/msp/tenants/{id}/subscription' }}
### Path Parameters
The unique identifier of a tenant account
### Request-Body Parameters
The Price ID to change the subscription to.
```bash {{ title: 'cURL' }}
curl -X POST https://api.netbird.io/api/integrations/msp/tenants/{id}/subscription \
-H 'Content-Type: application/json' \
-H 'Authorization: Token ' \
--data-raw '{
"priceID": "price_1HhxOpBzq4JbCqRmJxkpzL2V"
}'
```
```js
const axios = require('axios');
let data = JSON.stringify({
"priceID": "price_1HhxOpBzq4JbCqRmJxkpzL2V"
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: '/api/integrations/msp/tenants/{id}/subscription',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Token '
},
data : data
};
axios(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
```
```python
import requests
import json
url = "https://api.netbird.io/api/integrations/msp/tenants/{id}/subscription"
payload = json.dumps({
"priceID": "price_1HhxOpBzq4JbCqRmJxkpzL2V"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Token '
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
```
```go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.netbird.io/api/integrations/msp/tenants/{id}/subscription"
method := "POST"
payload := strings.NewReader(`{
"priceID": "price_1HhxOpBzq4JbCqRmJxkpzL2V"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Token ")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
```
```ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.netbird.io/api/integrations/msp/tenants/{id}/subscription")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Token "
request.body = JSON.dump({
"priceID": "price_1HhxOpBzq4JbCqRmJxkpzL2V"
})
response = https.request(request)
puts response.read_body
```
```java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, '{
"priceID": "price_1HhxOpBzq4JbCqRmJxkpzL2V"
}');
Request request = new Request.Builder()
.url("https://api.netbird.io/api/integrations/msp/tenants/{id}/subscription")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization: Token ")
.build();
Response response = client.newCall(request).execute();
```
```php
'https://api.netbird.io/api/integrations/msp/tenants/{id}/subscription',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"priceID": "price_1HhxOpBzq4JbCqRmJxkpzL2V"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Token '
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```
---
## Invite existing account as a Tenant to the MSP account {{ tag: 'POST' , label: '/api/integrations/msp/tenants/{id}/invite' }}
### Path Parameters
The unique identifier of an existing tenant account
```bash {{ title: 'cURL' }}
curl -X POST https://api.netbird.io/api/integrations/msp/tenants/{id}/invite \
-H 'Accept: application/json' \
-H 'Authorization: Token '
```
```js
const axios = require('axios');
let config = {
method: 'post',
maxBodyLength: Infinity,
url: '/api/integrations/msp/tenants/{id}/invite',
headers: {
'Accept': 'application/json',
'Authorization': 'Token '
}
};
axios(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
```
```python
import requests
import json
url = "https://api.netbird.io/api/integrations/msp/tenants/{id}/invite"
headers = {
'Accept': 'application/json',
'Authorization': 'Token '
}
response = requests.request("POST", url, headers=headers)
print(response.text)
```
```go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.netbird.io/api/integrations/msp/tenants/{id}/invite"
method := "POST"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Token ")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
```
```ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.netbird.io/api/integrations/msp/tenants/{id}/invite")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Authorization"] = "Token "
response = https.request(request)
puts response.read_body
```
```java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://api.netbird.io/api/integrations/msp/tenants/{id}/invite")
.method("POST")
.addHeader("Accept", "application/json")
.addHeader("Authorization: Token ")
.build();
Response response = client.newCall(request).execute();
```
```php
'https://api.netbird.io/api/integrations/msp/tenants/{id}/invite',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Authorization: Token '
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```
```json {{ title: 'Example' }}
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "My new tenant",
"domain": "tenant.com",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"role": "admin"
}
],
"activated_at": "2021-08-01T12:00:00Z",
"dns_challenge": "YXNkYSBkYXNhc2Rhc2RhIGFzZGFzZDJhc2QyNDUxNQ",
"created_at": "2021-08-01T12:00:00Z",
"updated_at": "2021-08-01T12:00:00Z",
"invited_at": "2021-08-01T12:00:00Z",
"status": "active"
}
```
```json {{ title: 'Schema' }}
{
"id": "string",
"name": "string",
"domain": "string",
"groups": [
{
"id": "string",
"role": "string"
}
],
"activated_at": "string",
"dns_challenge": "string",
"created_at": "string",
"updated_at": "string",
"invited_at": "string",
"status": "string"
}
```
---
## Response by the invited Tenant account owner {{ tag: 'PUT' , label: '/api/integrations/msp/tenants/{id}/invite' }}
### Path Parameters
The unique identifier of an existing tenant account
### Request-Body Parameters
Accept or decline the invitation.
```bash {{ title: 'cURL' }}
curl -X PUT https://api.netbird.io/api/integrations/msp/tenants/{id}/invite \
-H 'Content-Type: application/json' \
-H 'Authorization: Token ' \
--data-raw '{
"value": {
"type": "string",
"description": "Accept or decline the invitation.",
"enum": [
"accept",
"decline"
]
}
}'
```
```js
const axios = require('axios');
let data = JSON.stringify({
"value": {
"type": "string",
"description": "Accept or decline the invitation.",
"enum": [
"accept",
"decline"
]
}
});
let config = {
method: 'put',
maxBodyLength: Infinity,
url: '/api/integrations/msp/tenants/{id}/invite',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Token '
},
data : data
};
axios(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
```
```python
import requests
import json
url = "https://api.netbird.io/api/integrations/msp/tenants/{id}/invite"
payload = json.dumps({
"value": {
"type": "string",
"description": "Accept or decline the invitation.",
"enum": [
"accept",
"decline"
]
}
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Token '
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
```
```go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.netbird.io/api/integrations/msp/tenants/{id}/invite"
method := "PUT"
payload := strings.NewReader(`{
"value": {
"type": "string",
"description": "Accept or decline the invitation.",
"enum": [
"accept",
"decline"
]
}
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Token ")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
```
```ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.netbird.io/api/integrations/msp/tenants/{id}/invite")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Token "
request.body = JSON.dump({
"value": {
"type": "string",
"description": "Accept or decline the invitation.",
"enum": [
"accept",
"decline"
]
}
})
response = https.request(request)
puts response.read_body
```
```java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, '{
"value": {
"type": "string",
"description": "Accept or decline the invitation.",
"enum": [
"accept",
"decline"
]
}
}');
Request request = new Request.Builder()
.url("https://api.netbird.io/api/integrations/msp/tenants/{id}/invite")
.method("PUT", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization: Token ")
.build();
Response response = client.newCall(request).execute();
```
```php
'https://api.netbird.io/api/integrations/msp/tenants/{id}/invite',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS => '{
"value": {
"type": "string",
"description": "Accept or decline the invitation.",
"enum": [
"accept",
"decline"
]
}
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Token '
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```
---