Skip to main content

invite-user

dci invite-user [body]

Invites a new user to the organization with specified role and organization.

Pass the request body as name: value arguments or pipe JSON on stdin — see Command structure.

Examples

# Invite a user with a role; role IDs come from `dci list-roles`.
dci invite-user email: [email protected], roleId: <role-id>
# Fill in the name and job function as well.
dci invite-user email: [email protected], firstName: Jane, lastName: Doe, jobTitle: "Software / Ops Engineer", roleId: <role-id>
# Assign the user to an organization from a JSON file (organization IDs come from `dci list-organizations`).
dci invite-user < invite.json
# invite.json
{"email": "[email protected]", "roleId": "<role-id>", "organizationId": "<organization-id>"}
# Keep the new invite's ID for `resend-invite` or `cancel-invite`.
dci invite-user email: [email protected], roleId: <role-id> --fields user --output json

Request

Content-Type: application/json

FieldTypeRequiredDescription
emailstring (email)yesThe email address of the user.
firstNamestringThe first name of the user being invited.
lastNamestringThe last name of the user being invited.
jobTitlestringThe job function of the user being invited. One of: "Data Engineer / Data Analysts", "Executive Team", "Finance / Accounting", "Founder", "Legal / Purchasing", "Management", "Sales / Marketing", "Software / Ops Engineer".
roleIdstringThe ID of the role to assign to the user.
organizationIdstringThe ID of the organization to assign the user to.
Raw JSON schema
{
"type": "object",
"description": "Request body to invite a new user to the organization.",
"required": [
"email"
],
"properties": {
"email": {
"type": "string",
"description": "The email address of the user.",
"format": "email"
},
"firstName": {
"type": "string",
"description": "The first name of the user being invited."
},
"lastName": {
"type": "string",
"description": "The last name of the user being invited."
},
"jobTitle": {
"type": "string",
"description": "The job function of the user being invited.",
"enum": [
"Data Engineer / Data Analysts",
"Executive Team",
"Finance / Accounting",
"Founder",
"Legal / Purchasing",
"Management",
"Sales / Marketing",
"Software / Ops Engineer"
]
},
"roleId": {
"type": "string",
"description": "The ID of the role to assign to the user."
},
"organizationId": {
"type": "string",
"description": "The ID of the organization to assign the user to."
}
}
}

Output

Created - User invitation created successfully.

By default dci renders the result as a table. Use --output json to get the full structure described below — see Output formats.

FieldTypeDescription
messagestringSuccess message
userobject
user.idstringThe unique ID of the invited user.
user.emailstringThe email address of the invited user.
user.firstNamestringThe first name of the invited user, if provided during invitation.
user.lastNamestringThe last name of the invited user, if provided during invitation.
user.displayNamestringThe display name of the invited user, if provided during invitation.
user.jobTitlestringThe job function of the invited user, if provided during invitation.
user.roleIdstringThe ID of the role assigned to the user.
user.organizationIdstringThe ID of the organization assigned to the user.
user.statusstringThe status of the user (invited) One of: "invited".
Raw JSON schema
{
"type": "object",
"description": "Response returned after creating a user invitation.",
"properties": {
"message": {
"type": "string",
"description": "Success message"
},
"user": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The unique ID of the invited user."
},
"email": {
"type": "string",
"description": "The email address of the invited user."
},
"firstName": {
"type": "string",
"description": "The first name of the invited user, if provided during invitation."
},
"lastName": {
"type": "string",
"description": "The last name of the invited user, if provided during invitation."
},
"displayName": {
"type": "string",
"description": "The display name of the invited user, if provided during invitation."
},
"jobTitle": {
"type": "string",
"description": "The job function of the invited user, if provided during invitation."
},
"roleId": {
"type": "string",
"description": "The ID of the role assigned to the user."
},
"organizationId": {
"type": "string",
"description": "The ID of the organization assigned to the user."
},
"status": {
"type": "string",
"description": "The status of the user (invited)",
"enum": [
"invited"
]
}
}
}
}
}

Errors

On failure, dci prints a single error message — with a hint when one is available — and exits with a typed code your scripts can branch on. See Errors and exit codes for the full contract.

HTTP status to exit code mapping
HTTP statusExit codeError codeMeaning
40030VALIDATION_ERRORThe arguments or request body were rejected. Review the command's flags and payload.
40110AUTHENTICATION_FAILEDNot signed in, or the API token is invalid. Run dci login or check DCI_API_KEY.
40311PERMISSION_DENIEDThe DoiT user or the active customer context does not have access.
50040API_SERVER_ERRORThe API failed to process the request. Retryable; contact DoiT support if it persists.

Aliases: inviteuser