Relationships API
Request, accept, reject, or cancel a managed-service link.
The handler path is /api/msps/:mspId/clients/:clientId/relationship/:relationshipId. GET /api/msps/:mspId/relationship lists pending requests for the MSP. POST creates a request. PUT accepts or rejects. DELETE cancels.
Lifecycle
requested → accepted and represented in mspClients
requested → rejected and removed
requested → cancelled by the initiator
Endpoints
| Method | Path | What it does |
|---|---|---|
| GET | /api/msps/:mspId/relationship | List pending relationships |
| POST | /api/msps/:mspId/clients/:clientId/relationship | Create a request |
| PUT | /api/msps/:mspId/clients/:clientId/relationship/:relationshipId | Accept or reject |
| DELETE | /api/msps/:mspId/clients/:clientId/relationship/:relationshipId | Cancel a request |
Respond to a relationship
PUT /api/msps/:mspId/clients/:clientId/relationship/:relationshipId accepts or rejects the request.
Request
curl -X PUT "https://api.requestrocket.com/api/msps/:mspId/clients/:clientId/relationship/:relationshipId" \
-H "Authorization: u-your-token" \
-H "Content-Type: application/json" \
-d '{
"acceptRelationship": true
}'import axios from "axios";
const response = await axios.request({
method: "PUT",
url: "https://api.requestrocket.com/api/msps/:mspId/clients/:clientId/relationship/:relationshipId",
headers: {
"Authorization": "u-your-token",
"Content-Type": "application/json",
},
data: {
"acceptRelationship": true
}
});
console.log(response.status, response.data);import requests
response = requests.request(
"PUT",
"https://api.requestrocket.com/api/msps/:mspId/clients/:clientId/relationship/:relationshipId",
headers={
"Authorization": "u-your-token",
"Content-Type": "application/json",
},
data="{\n \"acceptRelationship\": true\n}"
)
print(response.status_code, response.json())package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"acceptRelationship": true
}`)
req, _ := http.NewRequest("PUT", "https://api.requestrocket.com/api/msps/:mspId/clients/:clientId/relationship/:relationshipId", payload)
req.Header.Set("Authorization", "u-your-token")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(body))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.requestrocket.com/api/msps/:mspId/clients/:clientId/relationship/:relationshipId"))
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"acceptRelationship\": true\n}"))
.header("Authorization", "u-your-token")
.header("Content-Type", "application/json")
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}Responses
{
"message": "Relationship accepted"
}{
"message": "Only the client can accept an MSP-initiated relationship request"
}{
"Message": "User is not authorized to access this resource with an explicit deny in an identity-based policy"
}{
"message": "method / endpoint not supported"
}Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
acceptRelationship | boolean | true accepts a request the organisation started. false rejects the request. Omit the field to extend the pending request by 14 days. |
Returns a message. Accept and reject do not return the relationship record. A refresh returns relationships with the updated expiry. The MSP can accept only a request whose initiatedBy is client.
Response
| Attribute | Type | Description |
|---|---|---|
message | string | Relationship accepted, Relationship rejected, or Relationship request updated. |
relationships | array | Present when the pending request is refreshed. Same attributes as the list response. |
List pending relationships
GET /api/msps/:mspId/relationship returns pending requests for the MSP, both those the MSP sent and those an organisation sent to the MSP.
Query parameters
None.
Response
| Attribute | Type | Description |
|---|---|---|
relationships | array | Pending requests. |
relationships[].relationshipId | string | Request id. Use it on the accept, reject, and cancel routes. |
relationships[].mspId | string | MSP id. |
relationships[].mspName | string | MSP name. |
relationships[].clientId | string | Organisation id. |
relationships[].clientName | string | Organisation name. |
relationships[].initiatedBy | string | msp or client. The MSP can accept a request only when this is client. |
relationships[].TTL | number | Unix expiry, in seconds. A new or refreshed request lasts 14 days. |
message | string | Success. |
Create a relationship request
POST /api/msps/:mspId/clients/:clientId/relationship asks an existing organisation to link. This call has no request body. The MSP and organisation ids come from the path. If a pending request already exists for the pair, the call refreshes it and returns 200.
Returns the pending request. A new request returns 201.
Response
| Attribute | Type | Description |
|---|---|---|
relationships | array | The pending request. Same attributes as the list response. |
message | string | Relationship request sent, or Existing relationship request refreshed. |
Cancel a relationship request
DELETE /api/msps/:mspId/clients/:clientId/relationship/:relationshipId cancels a pending request. This call has no request body.
Returns a confirmation. The organisation is not detached by this call.
Response
| Attribute | Type | Description |
|---|---|---|
message | string | Relationship request cancelled. |
Shared status codes, the 5.5 MB cap, and plan rate limits are on Platform limits.