Update a user
PATCH/v1/users/:user_email
This route allows you to update a user's details. This can be used to update the user's role/s and team/s.
To learn more about users, roles, and teams, check out the documentation.
Request
Parameters (JSON)
{
"parameters": [
{
"schema": {
"type": "string"
},
"in": "path",
"name": "user_email",
"required": true,
"description": "The email address or ID of the user you want to operate on. The user's ID is returned in the `id` field from [Get all users in your organization](https://docs.port.io/api-reference/get-all-users-in-your-organization/) or [Get a user](https://docs.port.io/api-reference/get-a-user/)."
}
]
}Request body schema (JSON)
{
"title": "Body",
"body": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"roles": {
"type": "array",
"minItems": 1,
"items": {
"type": "string"
},
"description": "The roles you want to assign to the user."
},
"teams": {
"type": "array",
"items": {
"type": "string"
},
"description": "The names of the teams you want to assign the user to."
}
},
"additionalProperties": false
}
}
}
}
}Responses
- 200
- 401
- 404
- 413
- 422
Updated successfully.
Default Response
A resource with the provided identifier was not found
Request body is too large (limit is 1MiB)
The json provided does not match the route's schema
Responses (JSON)
{
"responses": {
"200": {
"description": "Updated successfully.",
"content": {
"application/json": {
"schema": {
"properties": {
"ok": {
"enum": [
true
]
},
"email": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"picture": {
"type": "string"
},
"status": {
"type": "string"
},
"id": {
"type": "string"
},
"type": {
"type": "string"
},
"providers": {
"type": "array",
"items": {
"type": "string"
}
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"updatedAt": {
"type": "string",
"format": "date-time"
},
"orgs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
]
}
},
"teams": {
"type": "array",
"items": {
"type": "string"
}
},
"roles": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"required": [
"name"
]
}
},
"orgMembers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"orgId": {
"type": "string"
},
"status": {
"type": "string"
},
"lastLoginAt": {
"type": "string",
"format": "date-time"
}
},
"required": [
"orgId",
"status",
"lastLoginAt"
]
}
},
"termsAccepted": {
"type": "boolean",
"default": null
},
"managedByScim": {
"type": "boolean",
"default": null
},
"companyId": {
"type": "string",
"nullable": true
},
"companyRole": {
"type": "string",
"nullable": true
},
"userAccounts": {
"type": "array",
"items": {
"type": "object",
"properties": {
"accountId": {
"type": "string"
},
"accountRole": {
"type": "string"
}
}
}
}
},
"description": "Updated successfully.",
"required": [
"ok"
],
"additionalProperties": false
}
}
}
},
"401": {
"description": "Default Response",
"content": {
"application/json": {
"schema": {
"properties": {
"ok": {
"const": false
},
"error": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"ok",
"error"
],
"additionalProperties": false
}
}
}
},
"404": {
"description": "A resource with the provided identifier was not found",
"content": {
"application/json": {
"schema": {
"properties": {
"ok": {
"const": false
},
"error": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"ok",
"error",
"message"
],
"additionalProperties": false,
"description": "A resource with the provided identifier was not found"
}
}
}
},
"413": {
"description": "Request body is too large (limit is 1MiB)",
"content": {
"application/json": {
"schema": {
"properties": {
"ok": {
"const": false
},
"error": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"ok",
"error"
],
"additionalProperties": false,
"description": "Request body is too large (limit is 1MiB)"
}
}
}
},
"422": {
"description": "The json provided does not match the route's schema",
"content": {
"application/json": {
"schema": {
"properties": {
"ok": {
"const": false
},
"error": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"ok",
"error",
"message"
],
"additionalProperties": false,
"description": "The json provided does not match the route's schema"
}
}
}
}
}
}