Sec-Tokens Create¶
Create a new security token.
Usage¶
s10k sec-tokens create [-r] -t=<tokenType> [-n=<name>]
[-D=<description>] [-node=nodeId[,nodeId...]]...
[-source=sourceId[,sourceId...]]...
[-N=metaPath[,metaPath...]]...
[-U=metaPath[,metaPath...]]...
[-A=path[,path...]]...
[-exp=<expirationDate>] [-tz=<zone>]
[-mode=<displayMode>]
[-agg=aggregation |
--aggregation=aggregation[,aggregation...]...]
[-loc=precision |
--location-precision=precision[,precision...]...]
Options¶
Output¶
The new security token, with its associated secret.
Warning
You must copy the token secret to a safe place, as SolarNetwork will not show you its value ever again.
Examples¶
Create a basic ReadNodeData
token with no policy restrictions:
s10k sec-tokens create --type ReadNodeData
+----------------------+---------------------------+--------------------------------+---------+--------------+------+-------------+--------+
| Token ID | Token Secret | Created | User ID | Type | Name | Description | Policy |
+----------------------+---------------------------+--------------------------------+---------+--------------+------+-------------+--------+
| ZCv5FUjlTlIQGjigLhSW | i.3R5qMQ-4sKg8uUV0XoxBY5y | 2025-09-29T03:51:32.388051375Z | 123 | ReadNodeData | | | |
+----------------------+---------------------------+--------------------------------+---------+--------------+------+-------------+--------+
Token ID,Token Secret,Created,User ID,Type,Name,Description,Policy
Lqc8Z_KzpD8.L0_em0Au,QlmQCrZaemdXmUNISggGF7ed,2025-09-29T03:52:13.248686631Z,123,ReadNodeData,,,
{
"id" : "WoRxAChcFZ.x7s2zT5Y6",
"authSecret" : "zcqVddxS0YTr6rzAtSA.Wq.x0tRzZL",
"created" : "2025-09-29 04:13:52.673034405Z",
"userId" : 123,
"status" : "Active",
"type" : "ReadNodeData",
"expired" : false
}
Create a User
token with a name, description, and various policy restrictions:
s10k sec-tokens create --type User --name 'Reporting: region 1' \
--description 'Allow access to region 1 for reporting team.' \
--node-id 100,101 --source-id '/REGION1/**' \
--min-aggregation Hour \
--refresh-allowed
+----------------------+----------------------------+--------------------------------+---------+------+---------------------+----------------------------------------------+------------------------------------+
| Token ID | Token Secret | Created | User ID | Type | Name | Description | Policy |
+----------------------+----------------------------+--------------------------------+---------+------+---------------------+----------------------------------------------+------------------------------------+
| kF67p6g30eUXQICUgzQf | PDX3VpOKmrc58HOOqUOv3HTmv0 | 2025-09-29T04:23:20.302916611Z | 123 | User | Reporting: region 1 | Allow access to region 1 for reporting team. | { |
| | | | | | | | "nodeIds" : [ 100, 101 ], |
| | | | | | | | "sourceIds" : [ "/REGION1/**" ], |
| | | | | | | | "minAggregation" : "Hour", |
| | | | | | | | "refreshAllowed" : true |
| | | | | | | | } |
+----------------------+----------------------------+--------------------------------+---------+------+---------------------+----------------------------------------------+------------------------------------+
Token ID,Token Secret,Created,User ID,Type,Name,Description,Policy
vWLOCdFTaB8IeF6__bl5,HQyeON_XND0YgkYlMHGz.7qPoYlP,2025-09-29T04:25:03.335116516Z,123,User,Reporting: region 1,Allow access to region 1 for reporting team.,"{
""nodeIds"" : [ 100, 101 ],
""sourceIds"" : [ ""/REGION1/**"" ],
""minAggregation"" : ""Hour"",
""refreshAllowed"" : true
}"
{
"id" : "0a.vDUsIQFDM.pOShkqf",
"authSecret" : "mvBMxQukn1TsvmyjxQb6lWEZyebUWp",
"created" : "2025-09-29 04:25:43.884356539Z",
"userId" : 123,
"name" : "Reporting: region 1",
"description" : "Allow access to region 1 for reporting team.",
"status" : "Active",
"type" : "User",
"expired" : false,
"policy" : {
"nodeIds" : [ 100, 101 ],
"sourceIds" : [ "/REGION1/**" ],
"minAggregation" : "Hour",
"refreshAllowed" : true
}
}