> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squarecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Get a workspace invite code

> Generate a single-use invite code with GET /v2/workspaces/members/code and give it to a workspace owner, who adds you with it. It expires in 5 minutes.

<ParamField header="Authorization" type="string" placeholder="API Key" required>
  The API key for your account. You can find this in your [account settings](https://squarecloud.app/en/account/security).
</ParamField>

Requires an API key with the `workspaces:manage` [scope](/en/api-reference/authentication#scopes).

Generates a short-lived invite code tied to the authenticated user's identity, not to any specific workspace. The user who wants to join shares this code out-of-band (chat, email) with a workspace owner, who then submits it via [Invite Member](/en/api-reference/endpoint/workspace/members/invite) along with the role to grant.

The code expires 5 minutes after generation and is single-use: it is invalidated as soon as it is redeemed. Request a new one if it expires before the owner adds you. Rate limited to 1 code every 5 minutes per user.

## Response

<ResponseField name="status" type="string">
  Indicates whether the call was successful: `success` if it was, `error` if not.
</ResponseField>

<ResponseField name="code" type="string">
  Your workspace invite code.
</ResponseField>

<ResponseExample>
  ```json theme={"system"}
  {
    "status": "success",
    "code": "9c1a499e623d2410226f1ecdc7e6daaec2fc6704"
  }
  ```
</ResponseExample>

## Common errors

| Code | HTTP | Meaning |
| - | - | - |
| `INTERNAL_SERVER_ERROR` | 500 | The invite code could not be persisted to cache. |

## Related

* CLI: [`squarecloud workspace member invite-code`](/en/cli-reference/workspace-members#squarecloud-workspace-member-invite-code)
* SDKs: [`api.workspaces.members.inviteCode()`](/en/sdks/js/workspaces) (JavaScript), [`client.workspaces.members.invite_code()`](/en/sdks/py/workspaces) (Python), [`c.Workspaces.Members.InviteCode()`](/en/sdks/go/workspaces) (Go)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.