NetStacksNetStacks

Connection Profiles API

Enterprise

Manage NetStacks Controller connection profiles and their encrypted secrets (passwords, SSH keys, SNMP communities, API tokens) through the API.

Overview

A connection profile holds the login details a device uses: a default username, SSH port, timeouts, automation transport, and a prioritized list of secrets. Every device points at one profile through its profile_id. Secrets are encrypted in the Controller vault, and the API never returns secret values in list or get responses.

These endpoints need credentials.manage. For the concepts and the Admin Console screens, see Credential vault.

Endpoints

MethodPathPurposePermission
GET/api/profilesList profilescredentials.manage
POST/api/profilesCreate a profilecredentials.manage
GET/api/profiles/:idGet a profilecredentials.manage
PUT/api/profiles/:idUpdate a profile (only the fields you send)credentials.manage
DELETE/api/profiles/:idDelete a profilecredentials.manage
GET/api/profiles/device-countsNumber of devices using each profilecredentials.manage
POST/api/profiles/assignAssign a profile to a list of devicescredentials.manage
GET/api/profiles/:id/secretsList a profile's secrets (metadata only)credentials.manage
POST/api/profiles/:id/secretsAdd a secretcredentials.manage
PUT/api/profiles/:id/secrets/:secret_idUpdate a secretcredentials.manage
DELETE/api/profiles/:id/secrets/:secret_idDelete a secretcredentials.manage
POST/api/profiles/:id/secrets/:secret_id/revealReturn the decrypted secret. Body: {"reason":"…"} (required, audit-logged)Profile owner or a reveal grant
GET/api/profiles/:id/grantsList who may use this profilecredentials.manage
POST/api/profiles/:id/grantsGrant a user or role accesscredentials.manage
DELETE/api/profiles/:id/grants/:grant_idRemove a grantcredentials.manage
GET/api/profiles/accessibleProfiles the caller may use, as {"items":[…]}Signed in
GET / PUT/api/profiles/accessible/defaultGet or set the caller's default profileSigned in

Create a profile

curl -s --cacert netstacks-ca.pem -X POST https://controller.example.com:3000/api/profiles \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"name": "Core switches", "username": "netops", "ssh_port": 22}'
FieldTypeNotes
namestringRequired.
descriptionstringOptional.
profile_typestringshared (default), personal, or service.
owner_idUUIDOwner of a personal profile.
usernamestringDefault login username.
ssh_portintegerSSH port.
automation_transport / automation_portstring / integerFor config automation: gnmi or netconf, and its port.
cli_flavorstringHow CLI output is parsed, for example auto.
connection_timeout / keepalive_intervalintegerSeconds.
auto_commandsstring[]Commands to run after connecting.
is_default / is_servicebooleanDefault-profile and service-profile flags.

The response is 201 with the profile.

Add a secret

Each secret is one way to authenticate. When a connection is made, secrets are tried in priority order (lowest first).

curl -s --cacert netstacks-ca.pem -X POST \
  https://controller.example.com:3000/api/profiles/51a2.../secrets \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"secret_type": "password", "username": "netops", "secret": "<password>", "priority": 1}'
FieldTypeNotes
secret_typestringRequired. password, ssh_key, snmp_community, api_token, or generic_secret.
secretstringRequired. The password, private key, community string, or token. Encrypted before storage.
usernamestringOptional. Overrides the profile username.
passphrasestringOptional SSH key passphrase.
enable_secretstringOptional enable / privileged-mode password.
priorityintegerOptional. Lower is tried first.
host / portstring / integerOptional.
allow_port_forwarding, allow_scp_sftp, record_sessionsbooleanOptional session policy flags.
expires_attimestampOptional expiry.
metadataobjectOptional.
Keep secrets out of shell history

Read secrets from a file or environment variable instead of typing them on the command line, for example -d @secret.json.

Assign a profile to devices

POST /api/profiles/assign sets profile_id on many devices at once. Send null as profile_id to clear the assignment.

{ "device_ids": ["8d1e...", "a41f..."], "profile_id": "51a2..." }

Access grants

Grants control which users and roles may use a profile. POST /api/profiles/:id/grants takes:

FieldTypeNotes
grantee_typestringuser or role.
grantee_idUUIDThe user or role ID.
permission_levelstringuse (default) or reveal.