CorefinityCorefinityDocs
Open the Control PanelControl Panel
Access · 7 of 7

Create a key for a user

Adds a public key to one of the site's users. A key added to the built-in web user, while SSH keys are on for your company, is a key for the whole environment: it is answered as POST /ssh/keys answers, followed with GET /ssh/changes/{change}, and counts against the limit on key changes (30 a minute for you, 120 for your company).

POST/api/corestack/sites/{site}/access/users/{user}/keys

Path parameters

siteintegerRequired

The id of a site row. A website's production site and each of its environments has its own id. Digits only. At least 1.

userintegerRequired

The id of one of the site's users, as GET /corestack/sites/{site}/access answers it. Digits only. At least 1.

Body

keystringRequired

One public key, in OpenSSH, PEM or PuTTY format. At most 16,384 bytes once the space around it is trimmed: a longer one is refused as too long to be a public key.

namestringRequired

A name to recognise the key by. Up to 64 characters.

Returns

201 The key was added. For a named user the answer is the key and its operation. For the built-in web user, while SSH keys are on, it is the environment key with a change_id.

Fields of the 201 answer

If it is refused

StatusReasonWhat to do
401noneSend a valid token as Authorization: Bearer <token>.
403company_unavailableYour company is unavailable.
403scope_requiredUse a token with the scope named in scope.
403restrictedRestricted keys are changed by staff.
403two_factor_requiredTurn on two-factor on your account, then send again.
404feature_offThis feature is not on for your organisation yet.
409busyAnother operation is running on the site. Wait for it to finish.
409in_useIt is still in use, still being removed, or managed somewhere else. Read the message: wait for the removal, remove what uses it first, or remove it where the message says.
409managed_elsewhereThis site is read-only here. Change it in the control panel that manages it.
409ssh_key_duplicateThe key is already added here. Use the existing one.
422invalidFix the field named in field; errors says why.
429rate_limitedWait for the seconds in Retry-After.
429ssh_throttledToo many SSH key changes — try again in a minute.
502noneRead the message; it says what happened.
503noneTry again shortly.

Reasons are listed by name in Errors and refusals.

The same task elsewhere

curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/access/users/3418/keys \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAAAExampleKeyOnlyDoNotUseThisIsNotARealKey6 supplier@desktop",
    "name": "Supplier desktop"
  }'
{
  "key": {
    "added_at": "2026-11-05T09:16:40+00:00",
    "added_by": {
      "id": 2011,
      "name": "Maya Okafor"
    },
    "bits": null,
    "can_delete": true,
    "comment": "supplier@desktop",
    "company_key_id": null,
    "fingerprint": "SHA256:oQwAERONEv3/COhZ7GWPxEIkoR6bRrONqBuTfNZJHBs",
    "id": 7313,
    "name": "Supplier desktop",
    "restricted": false,
    "restrictions": [],
    "source": "user",
    "status": "pending",
    "status_label": "Applying",
    "type": "ssh-ed25519"
  },
  "operation": {
    "applied_at": null,
    "can_retry": false,
    "cluster": {
      "id": 17,
      "name": "WordPress Cluster 1"
    },
    "committed_at": "2026-11-05T09:16:40Z",
    "completed_at": null,
    "created_at": "2026-11-05T09:16:40Z",
    "environment": {
      "env_id": "rs-northwind-harbourandfinch-example-com",
      "hostname": "harbourandfinch-example-com.northwind.cfstack.example.net",
      "id": 1042,
      "name": "Production",
      "role": "production",
      "role_label": "Production",
      "slug": "production"
    },
    "error": null,
    "failure_reason": null,
    "from_version": null,
    "hot": true,
    "id": 146,
    "install": null,
    "label": "Picked up by the platform",
    "notes": [],
    "parent_operation_id": null,
    "requested_by": {
      "id": 2011,
      "name": "Maya Okafor"
    },
    "reset_target": null,
    "result": null,
    "result_state": "none",
    "retried_by_operation_id": null,
    "retries_operation_id": null,
    "retry_requires": null,
    "revealed": null,
    "scope": "site",
    "site": {
      "domain": "harbourandfinch.example.com",
      "id": 1042
    },
    "status": "committed",
    "status_label": "Waiting for the platform",
    "step": "applied",
    "steps": [
      {
        "key": "saved",
        "label": "Saved",
        "state": "done"
      },
      {
        "key": "applied",
        "label": "Picked up by the platform",
        "state": "current"
      },
      {
        "key": "live",
        "label": "Live",
        "state": "todo"
      }
    ],
    "subject": null,
    "summary": "Add key \"Supplier desktop\" to supplier",
    "to_version": null,
    "type": "keys_change",
    "type_label": "SSH keys"
  }
}
Try it

Try it is off for this endpointIt has not been cleared for the console. Copy the request and run it yourself when you are sure.

Was this helpful?
Open in ClaudeOpen in ChatGPT