---
title: "Assign project role to user"
method: POST
path: "/projects/{project_id}/users/{user_id}/roles"
tags: ["Project user role assignments"]
---

# Assign project role to user

`POST /projects/{project_id}/users/{user_id}/roles`

Assigns a project role to a user within a project.

## Path parameters

- `project_id` string, required
- `user_id` string, required

## Request body

- PublicAssignOrganizationGroupRoleBody — Request payload for assigning a role to a group or user.
  - `role_id` string, required — Identifier of the role to assign.

## Response `200`

Project role assigned to the user successfully.

- UserRoleAssignment — Role assignment linking a user to a role.
  - `object` 'user.role', required — Always `user.role`.
  - `user` User, required — Represents an individual `user` within an organization.
    - `object` 'organization.user', required — The object type, which is always `organization.user`
    - `id` string, required — The identifier, which can be referenced in API endpoints
    - `name` string, nullable — The name of the user
    - `email` string, nullable — The email address of the user
    - `role` string, nullable — `owner` or `reader`
    - `added_at` integer, required — The Unix timestamp (in seconds) of when the user was added.
    - `is_default` boolean — Whether this is the organization's default user.
    - `created` integer — The Unix timestamp (in seconds) of when the user was created.
    - `user` object — Nested user details.
      - `object` 'user', required
      - `id` string, required
      - `email` string, nullable
      - `name` string, nullable
      - `picture` string, nullable
      - `enabled` boolean, nullable
      - `banned` boolean, nullable
      - `banned_at` integer, nullable
    - `is_service_account` boolean — Whether the user is a service account.
    - `is_scale_tier_authorized_purchaser` boolean, nullable — Whether the user is an authorized purchaser for Scale Tier.
    - `is_scim_managed` boolean — Whether the user is managed through SCIM.
    - `api_key_last_used_at` integer, nullable — The Unix timestamp (in seconds) of the user's last API key usage.
    - `technical_level` string, nullable — The technical level metadata for the user.
    - `developer_persona` string, nullable — The developer persona metadata for the user.
    - `projects` object, nullable — Projects associated with the user, if included.
      - `object` 'list', required
      - `data` object[], required
        - `id` string, nullable
        - `name` string, nullable
        - `role` string, nullable
  - `role` Role, required — Details about a role that can be assigned through the public Roles API.
    - `object` 'role', required — Always `role`.
    - `id` string, required — Identifier for the role.
    - `name` string, required — Unique name for the role.
    - `description` string, nullable, required — Optional description of the role.
    - `permissions` string[], required — Permissions granted by the role.
    - `resource_type` string, required — Resource type the role is bound to (for example `api.organization` or `api.project`).
    - `predefined_role` boolean, required — Whether the role is predefined and managed by OpenAI.

---

[API](https://skmtc.net/openai/apis/openai-api.md) · [All operations](https://skmtc.net/openai/apis/openai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openai/openai-api/revisions/dcd35773a322/schema)
