Skip to content
API Reference

Retrieve

client.Invitations.Get(ctx, token, query) (*InvitationGetResponse, error)
GET/invitations/{token}

View invitation details by token without consuming the token

ParametersExpand Collapse
token string
minLength1
maxLength500
query InvitationGetParams
XClientRequestID param.Field[string]optional

Unique request identifier specified by the originating caller and passed along by proxies.

formatuuid
ReturnsExpand Collapse
type InvitationGetResponse struct{…}

Public invitation details viewable by token

CreatedByName string

Name of the user who sent the invitation

Email string

Email address for the invitation

formatemail
ExpiresAt Time

When the invitation expires

formatdate-time
OrganizationName string

Name of the organization being invited to

Role that will be assigned when invitation is accepted

Accepts one of the following:
const OrganizationRoleOrgAdmin OrganizationRole = "org_admin"
const OrganizationRoleOrgMember OrganizationRole = "org_member"
const OrganizationRoleOrgViewer OrganizationRole = "org_viewer"

Status of an invitation

Accepts one of the following:
const InvitationStatusPending InvitationStatus = "pending"
const InvitationStatusAccepted InvitationStatus = "accepted"
const InvitationStatusExpired InvitationStatus = "expired"
const InvitationStatusRevoked InvitationStatus = "revoked"

Retrieve

package main

import (
  "context"
  "fmt"

  "github.com/keycardai/keycard-go"
  "github.com/keycardai/keycard-go/option"
)

func main() {
  client := keycard.NewClient(
    option.WithClientID("My Client ID"),
    option.WithClientSecret("My Client Secret"),
  )
  invitation, err := client.Invitations.Get(
    context.TODO(),
    "token",
    keycard.InvitationGetParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", invitation.CreatedByName)
}
{
  "created_by_name": "created_by_name",
  "email": "dev@stainless.com",
  "expires_at": "2019-12-27T18:11:19.117Z",
  "organization_name": "organization_name",
  "role": "org_admin",
  "status": "pending"
}
Returns Examples
{
  "created_by_name": "created_by_name",
  "email": "dev@stainless.com",
  "expires_at": "2019-12-27T18:11:19.117Z",
  "organization_name": "organization_name",
  "role": "org_admin",
  "status": "pending"
}