Skip to content

invitations

← All modules

5 endpoints.

GET /api/v1/tenants/{tenant_id}/invitations

List Invitations

200 — Successful Response

json
{
  "items": {
    "properties": {
      "id": {
        "type": "string",
        "title": "Id"
      },
      "tenant_id": {
        "type": "string",
        "title": "Tenant Id"
      },
      "email": {
        "type": "string",
        "title": "Email"
      },
      "role": {
        "type": "string",
        "title": "Role"
      },
      "status": {
        "type": "string",
        "title": "Status"
      },
      "expires_at": {
        "type": "string",
        "format": "date-time",
        "title": "Expires At"
      },
      "created_at": {
        "type": "string",
        "format": "date-time",
        "title": "Created At"
      },
      "accept_url": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ],
        "title": "Accept Url"
      },
      "has_account": {
        "type": "boolean",
        "title": "Has Account",
        "default": true
      }
    },
    "type": "object",
    "required": [
      "id",
      "tenant_id",
      "email",
      "role",
      "status",
      "expires_at",
      "created_at"
    ],
    "title": "InvitationResponse"
  },
  "type": "array",
  "title": "Response List Invitations Api V1 Tenants  Tenant Id  Invitations Get"
}

POST /api/v1/tenants/{tenant_id}/invitations

Create Invitation

Request body

json
{
  "properties": {
    "email": {
      "type": "string",
      "title": "Email"
    },
    "role": {
      "type": "string",
      "title": "Role",
      "default": "sales"
    },
    "preview": {
      "type": "boolean",
      "title": "Preview",
      "default": false
    }
  },
  "type": "object",
  "required": [
    "email"
  ],
  "title": "InvitationCreate"
}

201 — Successful Response

json
{
  "anyOf": [
    {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "tenant_id": {
          "type": "string",
          "title": "Tenant Id"
        },
        "email": {
          "type": "string",
          "title": "Email"
        },
        "role": {
          "type": "string",
          "title": "Role"
        },
        "status": {
          "type": "string",
          "title": "Status"
        },
        "expires_at": {
          "type": "string",
          "format": "date-time",
          "title": "Expires At"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At"
        },
        "accept_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Accept Url"
        },
        "has_account": {
          "type": "boolean",
          "title": "Has Account",
          "default": true
        }
      },
      "type": "object",
      "required": [
        "id",
        "tenant_id",
        "email",
        "role",
        "status",
        "expires_at",
        "created_at"
      ],
      "title": "InvitationResponse"
    },
    {
      "properties": {
        "to": {
          "type": "string",
          "title": "To"
        },
        "subject": {
          "type": "string",
          "title": "Subject"
        },
        "body_html": {
          "type": "string",
          "title": "Body Html"
        }
      },
      "type": "object",
      "required": [
        "to",
        "subject",
        "body_html"
      ],
      "title": "EmailPreview"
    }
  ],
  "title": "Response Create Invitation Api V1 Tenants  Tenant Id  Invitations Post"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

DELETE /api/v1/tenants/{tenant_id}/invitations/{invitation_id}

Revoke Invitation

Parameters

NameInRequiredTypeDescription
invitation_idpathyesinteger

200 — Successful Response

json
{
  "properties": {
    "detail": {
      "type": "string",
      "title": "Detail"
    }
  },
  "type": "object",
  "required": [
    "detail"
  ],
  "title": "MessageResponse"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

GET /api/v1/invitations/{token}

Preview Invitation

Public lookup so the accept-invite page can show the org name/role before the user commits, and whether the invited email already has an account (so the page shows a "set your password" form vs. a "sign in to accept" prompt).

Parameters

NameInRequiredTypeDescription
tokenpathyesstring

200 — Successful Response

json
{
  "properties": {
    "id": {
      "type": "string",
      "title": "Id"
    },
    "tenant_id": {
      "type": "string",
      "title": "Tenant Id"
    },
    "email": {
      "type": "string",
      "title": "Email"
    },
    "role": {
      "type": "string",
      "title": "Role"
    },
    "status": {
      "type": "string",
      "title": "Status"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time",
      "title": "Expires At"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "accept_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Accept Url"
    },
    "has_account": {
      "type": "boolean",
      "title": "Has Account",
      "default": true
    }
  },
  "type": "object",
  "required": [
    "id",
    "tenant_id",
    "email",
    "role",
    "status",
    "expires_at",
    "created_at"
  ],
  "title": "InvitationResponse"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

POST /api/v1/invitations/accept

Accept Invitation

Accept an invite. Two paths:

  • Invited email already has an account: the caller must be logged in as that user (existing behaviour). Creates/reactivates the membership and returns the tenant so the frontend can switch to it.
  • Invited email has no account yet: full_name + password are required. Creates the User in this same step, then the membership, and returns fresh tokens so the new user lands signed in — no separate signup.

Request body

json
{
  "properties": {
    "token": {
      "type": "string",
      "title": "Token"
    },
    "full_name": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255,
          "minLength": 1
        },
        {
          "type": "null"
        }
      ],
      "title": "Full Name"
    },
    "password": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 128,
          "minLength": 8
        },
        {
          "type": "null"
        }
      ],
      "title": "Password"
    }
  },
  "type": "object",
  "required": [
    "token"
  ],
  "title": "InvitationAccept"
}

200 — Successful Response

json
{
  "anyOf": [
    {
      "properties": {
        "access_token": {
          "type": "string",
          "title": "Access Token"
        },
        "refresh_token": {
          "type": "string",
          "title": "Refresh Token"
        },
        "token_type": {
          "type": "string",
          "title": "Token Type",
          "default": "bearer"
        }
      },
      "type": "object",
      "required": [
        "access_token",
        "refresh_token"
      ],
      "title": "TokenResponse"
    },
    {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "slug": {
          "type": "string",
          "title": "Slug"
        },
        "plan_tier": {
          "type": "string",
          "title": "Plan Tier"
        },
        "status": {
          "type": "string",
          "title": "Status"
        },
        "role": {
          "type": "string",
          "title": "Role"
        },
        "icon_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Icon Url"
        },
        "domain_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Domain Name"
        },
        "domain_names": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Domain Names",
          "default": []
        },
        "parent_tenant_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Parent Tenant Id"
        },
        "is_reseller": {
          "type": "boolean",
          "title": "Is Reseller",
          "default": false
        }
      },
      "type": "object",
      "required": [
        "id",
        "name",
        "slug",
        "plan_tier",
        "status",
        "role"
      ],
      "title": "TenantSummary",
      "description": "A tenant the current user belongs to, plus their role in it."
    }
  ],
  "title": "Response Accept Invitation Api V1 Invitations Accept Post"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

Lubb ERP Documentation