> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Introduction

## Article: Introduction

## Article Link: https://dev.wix.com/docs/api-reference/account-level/channels/eligibility/account-code-v1/introduction.md

## Article Content:

# About the Account Code API

The Account Code API lets a Channel invite its users to Wix with one-time-use sign-in
invite links. When a user opens their link and signs up or logs in to Wix, their account
is linked to the Channel's account as a sub-account.

With the Account Code API, you can:

- Generate batches of ready-to-use sign-in invite links for your users.
- Delete account codes, so their invite links can no longer be redeemed.

## Account code lifecycle

Each invite link contains an account code. An account code goes through these stages:

1. **Generated**: [Generate Account Invite Links](https://dev.wix.com/docs/api-reference/account-level/channels/eligibility/account-code-v1/generate-account-invite-links.md)
   creates the account code and returns its invite link. By default, the account code
   stays redeemable for 182 days. You can request a lifetime between 60 seconds and 1 year.
1. **Redeemed**: A user opens the invite link and signs up or logs in to Wix. Their
   account is linked to your account as a sub-account. Each account code can be redeemed
   once, and each email address can redeem a single account code from your account.
1. **Deleted or expired**: An account code that's deleted or past its expiration date
   can't be redeemed. Deleting an account code that was already redeemed removes only
   the code. The user who redeemed it stays linked to your account.

## Before you begin

It's important to note the following points before starting to code:

- Your account must be set up by Wix as a Channel organization account. To get set up,
  contact your Wix partner manager. Otherwise, generating invite links fails with
  `ORGANIZATION_NOT_ELIGIBLE`.
- Call these methods with an account-level
  [API key](https://dev.wix.com/docs/overview/auth-permissions/authentication-methods.md) that has the
  Manage Channels Account Codes permission scope. The account that the API key belongs to
  is always the account the codes are generated for or deleted from. You can't act on
  another account's codes.
- An account can have up to 5,000,000 active account codes, meaning codes that haven't
  been redeemed and haven't expired. If generating a batch would exceed this limit, the
  call fails and no account codes are created.
- If some account codes in a batch can't be created, for example due to a temporary
  storage issue, the call still succeeds and returns fewer invite links than you
  requested. The response reports how many account codes were created and how many failed.
- An invite code that belongs to a different account returns the same error as an invite
  code that doesn't exist.

## Use cases

- [Invite your users to Wix and link them to your account](https://dev.wix.com/docs/api-reference/account-level/channels/eligibility/account-code-v1/sample-flows.md#invite-your-users-to-wix-and-link-them-to-your-account)
- [Revoke an invite link sent by mistake](https://dev.wix.com/docs/api-reference/account-level/channels/eligibility/account-code-v1/sample-flows.md#revoke-an-invite-link-sent-by-mistake)
- [Clean up unused invite links](https://dev.wix.com/docs/api-reference/account-level/channels/eligibility/account-code-v1/sample-flows.md#clean-up-unused-invite-links)

## Terminology

- **Channel**: A partner integration that's set up by Wix as an organization account.
  A Channel refers its users to Wix and has those users linked to its own account.
- **Organization account**: The Wix account that represents a Channel. It appears as
  `organizationId` in invite links.
- **Sub-account**: A user's Wix account that's linked to a Channel's organization account.
- **Account code**: A signed, one-time-use code that links the account of the user who
  redeems it to a Channel's account.
- **Invite link**: A full sign-in URL that contains an account code. For example,
  `https://users.wix.com/signin?organizationId=<accountId>&organizationInviteCode=<code>`.
- **Invite code**: The value of the `organizationInviteCode` query parameter in an invite
  link. Use it to identify an account code when you delete it.

@sdk_package_setup