REST API
Project
Invite Collaborator

Invite Collaborator to Project

POST /v2/projects/{project_id}/invite

Invite a collaborator to a specific project by sending a POST request to the Qubitro API.

Supported roles for collaborators include: admin, readonly, and readwrite.

invite-collaborator.ts
import type { NextApiRequest, NextApiResponse } from 'next';
 
export default async function handler(
    req: NextApiRequest,
    res: NextApiResponse<any>
) {
    const { projectId } = req.query;
    const requestBody = {
        email: "user.email@domain.com",
        role: "admin"
    };
 
    const result = await fetch(`https://api.qubitro.com/v2/projects/${projectId}/invite`, {
        headers: {
            'Content-Type': 'application/json',
            'Authorization': 'Bearer <API_KEY>'
        },
        method: "POST",
        body: JSON.stringify(requestBody)
    });
 
    const data = await result.json();
    res.status(200).json(data);
}

Request Body Parameters

OptionTypeDescription
emailstringThe email address of the collaborator to invite.
rolestringThe role to assign to the collaborator. Supported values: admin, readonly, readwrite.

Response

On success, the API will return a JSON object with the following structure:

{
    "success": true,
    "action": "invite collaborator",
    "status": 200
}
Response codes
OptionTypeDescription
200OKThe request was successful.
400Bad RequestThe request could not be understood or was missing required parameters.
401UnauthorizedAuthentication failed or was not provided.
403ForbiddenAuthentication succeeded, but the authenticated user does not have access to the requested resource.
404Not FoundThe requested resource could not be found.
500Internal Server ErrorAn error occurred on the server.

logo

Start building today

Collect, process, and activate device data. Scale from one device to thousands.

Qubitro Logo

Product

Decision Aids

Resources

Company

© 2024 Qubitro, Inc. All rights reserved