Skip to main content
Python
from openlayer import Openlayer

client = Openlayer()
client.workspaces.invites.create(
  workspace_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  emails=["john@doe.com", "jane@doe.com"],
  role="ADMIN"
)
import Openlayer from 'openlayer';

const openlayer = new Openlayer();
await openlayer.workspaces.invites.create(
  {workspaceId: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", emails: ["john@doe.com", "jane@doe.com"], role: "ADMIN"}
)
package main

import (
  "context"

  "github.com/openlayer-ai/openlayer-go"
  "github.com/openlayer-ai/openlayer-go/option"
)

client := openlayer.NewClient()
client.Workspaces.Invites.New(
  context.TODO(),
  "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  openlayer.WorkspaceInviteNewParams{
    Emails: []string{"john@doe.com", "jane@doe.com"},
    Role: "ADMIN",
  },
)
import com.openlayer.api.client.OpenlayerClient;
import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient;
import com.openlayer.api.models.WorkspaceInviteNewParams;
import com.openlayer.api.models.WorkspaceInviteNewResponse;

OpenlayerClient client = OpenlayerOkHttpClient.fromEnv();

WorkspaceInviteNewParams params = WorkspaceInviteNewParams.builder().build();
WorkspaceInviteNewResponse response = client.workspaces().invites().new(params);
curl --request POST \
  --url https://api.openlayer.com/v1/workspaces/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e/invites \
  --header 'Authorization: Bearer <token>' \
  --data '{
    "emails": ["john@doe.com", "jane@doe.com"],
    "role": "ADMIN"
  }'
{
  "items": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "dateCreated": "2023-11-07T05:31:56Z",
      "creator": {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "username": "user123",
        "name": "Rishab Ramanathan"
      },
      "workspace": {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "name": "Openlayer",
        "slug": "openlayer",
        "dateCreated": "2023-11-07T05:31:56Z",
        "memberCount": 1
      },
      "email": "user@email.com"
    }
  ]
}
{
  "code": 123,
  "error": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your workspace API key. See Find your API key for more information.

Path Parameters

workspaceId
string<uuid>
required

The workspace id.

Body

application/json
emails
any[]
role
any

Response

Status OK.

items
object[]
required