Skip to main content

Create an SSH user for a Project

POST/v2/projects/{projectId}/ssh-users
API version
v2
Request method
POST
Operation ID
ssh-user-create-ssh-user

Request​

  • projectIdstringrequired

    ID of the Project to create an SSHUser for.

Responses​

Format
application/json
Description

Created

  • activeboolean
  • authUpdatedAtstring (date-time)required
  • createdAtstring (date-time)required
  • descriptionstringrequired
  • detailedPublicKeysarray of object
    • Array[

      A representation of an ssh-public-key, enriched with information derived from the key.

      • *object

        A representation of an ssh-public-key, enriched with information derived from the key.

        • algorithmstring

          Absent if the key cannot be parsed.

        • commentstringrequired
        • fingerprintstring

          SHA256 fingerprint in OpenSSH format, as printed by ssh-keygen -l. Absent if the key cannot be parsed.

        • keystringrequired
      ]
  • expiresAtstring (date-time)
  • hasPasswordbooleanrequired
  • idstringrequired
  • projectIdstringrequired
  • publicKeysarray of objectdeprecated

    deprecated by detailedPublicKeys

    • Array[

      A representation of an ssh-public-key.

      • *object

        A representation of an ssh-public-key.

        • commentstringrequired
        • keystringrequired
      ]
  • updatedAtstring (date-time)
  • userNamestringrequired
Content-Type: application/json

{
"active": true,
"authUpdatedAt": "1985-10-26T01:21:00.000Z",
"createdAt": "1985-10-26T01:21:00.000Z",
"description": "string",
"detailedPublicKeys": [
{
"algorithm": "ssh-ed25519",
"comment": "string",
"fingerprint": "SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s",
"key": "string"
}
],
"expiresAt": "1985-10-26T01:21:00.000Z",
"hasPassword": true,
"id": "string",
"projectId": "string",
"updatedAt": "1985-10-26T01:21:00.000Z",
"userName": "string"
}
{
"description": "A representation of an SSHUser.",
"properties": {
"active": {
"type": "boolean"
},
"authUpdatedAt": {
"format": "date-time",
"type": "string"
},
"createdAt": {
"format": "date-time",
"type": "string"
},
"description": {
"type": "string"
},
"detailedPublicKeys": {
"items": {
"description": "A representation of an ssh-public-key, enriched with information derived from the key.",
"properties": {
"algorithm": {
"description": "Absent if the key cannot be parsed.",
"example": "ssh-ed25519",
"type": "string"
},
"comment": {
"type": "string"
},
"fingerprint": {
"description": "SHA256 fingerprint in OpenSSH format, as printed by `ssh-keygen -l`. Absent if the key cannot be parsed.",
"example": "SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s",
"type": "string"
},
"key": {
"type": "string"
}
},
"required": [
"comment",
"key"
],
"type": "object"
},
"type": "array"
},
"expiresAt": {
"format": "date-time",
"type": "string"
},
"hasPassword": {
"type": "boolean"
},
"id": {
"type": "string"
},
"projectId": {
"type": "string"
},
"publicKeys": {
"deprecated": true,
"description": "deprecated by detailedPublicKeys",
"items": {
"description": "A representation of an ssh-public-key.",
"properties": {
"comment": {
"type": "string"
},
"key": {
"type": "string"
}
},
"required": [
"comment",
"key"
],
"type": "object"
},
"type": "array"
},
"updatedAt": {
"format": "date-time",
"type": "string"
},
"userName": {
"type": "string"
}
},
"required": [
"id",
"projectId",
"description",
"userName",
"createdAt",
"authUpdatedAt",
"hasPassword"
],
"type": "object"
}

Usage examples​

$ curl \
--fail \
--location \
-X POST \
-d '{"authentication":{"password":"string"},"description":"string","expiresAt":"1985-10-26T01:21:00.000Z"}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/projects/string/ssh-users
import { MittwaldAPIV2Client } from "@mittwald/api-client";
import { assertStatus } from "@mittwald/api-client-commons";

const client = MittwaldAPIClient.newWithToken(process.env.MITTWALD_API_TOKEN);
const response = await client.sshsftpUser.sshUserCreateSshUser({
"projectId": "string",
"data": {
"authentication": {
"password": "string"
},
"description": "string",
"expiresAt": "1985-10-26T01:21:00.000Z"
}
});

assertStatus(response, 201);

use \Mittwald\ApiClient\Generated\V2\Clients\SSHSFTPUser\SshUserCreateSshUser\SshUserCreateSshUserRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\SSHSFTPUser\SshUserCreateSshUser\SshUserCreateSshUserRequestBody;

$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));

// TODO: Please consult the properties and constructor signature of
// SshUserCreateSshUserRequestBody to learn how to construct a valid instance
$body = new SshUserCreateSshUserRequestBody(/* TODO: ... */);

$request = (new SshUserCreateSshUserRequest(
projectId: "string",
body: $body
));
$response = $client->sshsftpUser()->sshUserCreateSshUser($request);

var_dump($response->getBody();

On this page