Skip to main content

Save Invites

PUT 

//localhost:58231/user-svc/invites

Invite a list of users by contact ID to acquire a role. Works on future or current users. A user can only invite an other user to a role if the user owns that role.

A user "owns" a role in the following cases:

  • A static role where the role ID is prefixed with the caller's slug.
  • Any dynamic or static role where the caller is an admin.

Examples:

  • A user with the slug "joe-doe" owns roles like "joe-doe:any-custom-role".
  • A user with any slug who has the role "my-service:admin" owns "my-service:user".
  • A user with any slug who has the role "user-svc:org:{%orgId}:admin" owns "user-svc:org:{%orgId}:user".

Request

Bodyrequired

Save Invites Request

    invites object[]required
  • Array [
  • contactIdstringrequired
    idstring
    Example: inv_fIYPbMHIcI
    roleIdstringrequired
  • ]

Responses

Invites saved successfully

Schema
    invites object[]required
  • Array [
  • appliedAtstring
    contactIdstringrequired

    ContactId represents the recipient of the invite. If the user is already registered, the role is assigned immediately; otherwise, it is applied upon registration.

    createdAtstringrequired
    deletedAtstring
    expiresAtstring
    idstringrequired
    Example: inv_fIYPbMHIcI
    ownerIdsstring[]required

    OwnerIds specifies the users who created the invite. If you create an invite that already exists for a given role and contact ID, you get added to the list of owners.

    roleIdstringrequired

    RoleId specifies the role to be assigned to the ContactId. Callers can only assign roles they own, identified by their service slug (e.g., if "my-service" creates an invite, the role must be "my-service:admin"). Dynamic organization roles can also be assigned (e.g., "user-svc:org:{%orgId}:admin" or "user-svc:org:{%orgId}:user"), but in this case, the caller must be an admin of the target organization.

    updatedAtstring
  • ]

Authorization: Authorization

name: Authorizationtype: apiKeydescription: Type "Bearer" followed by a space and token acquired from the User Svc Login endpoint.in: header
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Put, "//localhost:58231/user-svc/invites");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "<Authorization>");
var content = new StringContent("{\n \"invites\": [\n {\n \"contactId\": \"string\",\n \"id\": \"inv_fIYPbMHIcI\",\n \"roleId\": \"string\"\n }\n ]\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Request Collapse all
Base URL
//localhost:58231
Auth
Body required
{
  "invites": [
    {
      "contactId": "string",
      "id": "inv_fIYPbMHIcI",
      "roleId": "string"
    }
  ]
}
ResponseClear

Click the Send API Request button above and see the response here!