Create invite
client.admin.organization.invites.create(InviteCreateParams { email, role, projects } body, RequestOptionsoptions?): Invite { id, created_at, email, 6 more }
POST/organization/invites
Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization.
Create invite
import OpenAI from 'openai';
const client = new OpenAI({
adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted
});
const invite = await client.admin.organization.invites.create({ email: 'email', role: 'reader' });
console.log(invite.id);{
"object": "organization.invite",
"id": "invite-def",
"email": "anotheruser@example.com",
"role": "reader",
"status": "pending",
"created_at": 1711471533,
"expires_at": 1711471533,
"accepted_at": null,
"projects": [
{
"id": "project-xyz",
"role": "member"
},
{
"id": "project-abc",
"role": "owner"
}
]
}
Returns Examples
{
"object": "organization.invite",
"id": "invite-def",
"email": "anotheruser@example.com",
"role": "reader",
"status": "pending",
"created_at": 1711471533,
"expires_at": 1711471533,
"accepted_at": null,
"projects": [
{
"id": "project-xyz",
"role": "member"
},
{
"id": "project-abc",
"role": "owner"
}
]
}