Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation
Theme

Create invite

admin.organization.invites.create(**kwargs) -> 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

require "openai"

openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")

invite = openai.admin.organization.invites.create(email: "email", role: :reader)

puts(invite)
Response example
{
  "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"
    }
  ]
}
Parameters
email: String

Send an email to this address

role: :reader | :owner

owner or reader

projects: Array[Project{ id, role}]

An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one.

Returns
class Invite { id, created_at, email, 6 more }

Represents an individual invite to the organization.

id: String

The identifier, which can be referenced in API endpoints

created_at: Integer

The Unix timestamp (in seconds) of when the invite was sent.

formatunixtime
email: String

The email address of the individual to whom the invite was sent

object: :"organization.invite"

The object type, which is always organization.invite

projects: Array[Project{ id, role}]

The projects that were granted membership upon acceptance of the invite.

role: :owner | :reader

owner or reader

status: :accepted | :expired | :pending

accepted,expired, or pending

accepted_at: Integer

The Unix timestamp (in seconds) of when the invite was accepted.

formatunixtime
expires_at: Integer

The Unix timestamp (in seconds) of when the invite expires.

formatunixtime
Returns Examples
Response example
{
  "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"
    }
  ]
}