Tokens

Generate a new token

INFO

In order to generate a new token, you will need to be authenticated and having at least the token:write permission with value *.

You will need to send a POST request to the /-/npm/v1/tokens endpoint with the following body:

1{
2	"name": "My token",
3	"scopes": [
4		{
5			"type": "package:read",
6			"values": ["*"]
7		},
8		{
9			"type": "package:write",
10			"values": ["@my-scope/my-package", "my-cool-package"]
11		}
12	]
13}

You can send has many scopes as you want.

Scope type Description
package:read Read access to a package
package:write Write access to a package
package:read+write Read and write access to a package
token:read Read access to a token
token:write Write access to a token
token:read+write Read and write access to a token
INFO

The values property is an array of strings. You can use glob patterns to match packages.

Get all tokens

You can get all tokens by sending a GET request to the /-/npm/v1/tokens endpoint.

1curl -X GET https://my-npflared.dev/-/npm/v1/tokens

Get a token

You can get a token by sending a GET request to the /-/npm/v1/tokens/token/:token endpoint.

1curl -X GET https://my-npflared.dev/-/npm/v1/tokens/token/my-token
INFO

The :token parameter is the token you want to get.

Delete a token

You can delete a token by sending a DELETE request to the /-/npm/v1/tokens/token/:token endpoint.

1curl -X DELETE https://my-npflared.dev/-/npm/v1/tokens/token/my-token

:::info The :token parameter is the token you want to delete.