SePay CLI manages sandbox API Tokens only, with simulated data that never touches production. A production API Token has access to the whole company, so it is created and revoked only in my.sepay.vn, see Create an API Token; the CLI doesn't create, view or revoke production tokens.
Your integration calls SePay API with an API Token sent in the Authorization: Bearer <API Token> header. In the sandbox, create and manage that token with the sepay apikey commands (short form sepay ak). The CLI itself signs in with sepay login and never uses an API Token.
apikey create
Creates a sandbox API Token:
$ sepay apikey create --name "dev-server"The command prints Created API key <xid>., then the token details; the Key row is the full token.
| Flag | Type | Required | Description |
|---|---|---|---|
--name | string | Yes | Token name, up to 200 characters |
--active | bool | No | Defaults to true. --active=false creates the token disabled |
apikey create is the only command that prints the full token; every other command shows it masked. Store it in an environment variable or your project's secret store right away. If you lose it, create a new token and delete the old one.
apikey list and apikey get
Lists your company's sandbox API Tokens. The KEY column shows each token masked:
$ sepay apikey listShows one token by xid. Leave the xid out and the CLI lets you pick from a list:
$ sepay apikey get <xid>apikey update
Disables a token without deleting it, for example while a test environment is paused:
$ sepay apikey update <xid> --active=falseTurn it back on with --active, rename it with --name "<new name>".
apikey delete
Deletes a token:
$ sepay apikey delete <xid> --yesThe command always asks for confirmation; in a script it needs --yes. A deleted token can't be restored, and SePay rejects code that still uses it.
Error messages
| Message | Cause | Fix |
|---|---|---|
apikey list is sandbox-only; drop --env production | An apikey command run with --env production | Drop --env production; production tokens are created in my.sepay.vn |
an API key xid is required | get, update or delete run in a script without an xid | Pass the xid from apikey list |
--name is required | create run in a script without --name | Add --name "<name>" |
nothing to update; pass --name and/or --active | update without --name or --active | Add the flag you want to change |
no API keys yet; create one with: sepay apikey create --name <name> | Your company has no sandbox API Token yet | Create one with apikey create |