Ethernovia Users-Permissions - Users & Roles API

Users, roles, and permissions endpoints

OpenAPI Specification

ethernovia-users-permissions-users-roles-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  version: 1.0.0
  title: DOCUMENTATION Users-Permissions - Users & Roles API
  description: Users, roles, and permissions endpoints
  termsOfService: YOUR_TERMS_OF_SERVICE_URL
  contact:
    name: TEAM
    email: contact-email@something.io
    url: mywebsite.io
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  x-generation-date: '2026-07-07T06:23:13.532Z'
servers:
- url: http://localhost:1337/api
  description: Development server
security:
- bearerAuth: []
tags:
- name: Users-Permissions - Users & Roles
  description: Users, roles, and permissions endpoints
  externalDocs:
    description: Find out more
    url: https://docs.strapi.io/developer-docs/latest/plugins/users-permissions.html
paths:
  /users-permissions/permissions:
    get:
      tags:
      - Users-Permissions - Users & Roles
      summary: Get default generated permissions
      responses:
        '200':
          description: Returns the permissions tree
          content:
            application/json:
              schema:
                type: object
                properties:
                  permissions:
                    $ref: '#/components/schemas/Users-Permissions-PermissionsTree'
              example:
                permissions:
                  api::content-type.content-type:
                    controllers:
                      controllerA:
                        find:
                          enabled: false
                          policy: ''
                        findOne:
                          enabled: false
                          policy: ''
                        create:
                          enabled: false
                          policy: ''
                      controllerB:
                        find:
                          enabled: false
                          policy: ''
                        findOne:
                          enabled: false
                          policy: ''
                        create:
                          enabled: false
                          policy: ''
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /users-permissions/roles:
    get:
      tags:
      - Users-Permissions - Users & Roles
      summary: List roles
      responses:
        '200':
          description: Returns list of roles
          content:
            application/json:
              schema:
                type: object
                properties:
                  roles:
                    type: array
                    items:
                      allOf:
                      - $ref: '#/components/schemas/Users-Permissions-Role'
                      - type: object
                        properties:
                          nb_users:
                            type: number
              example:
                roles:
                - id: 1
                  name: Public
                  description: Default role given to unauthenticated user.
                  type: public
                  createdAt: '2022-05-19T17:35:35.097Z'
                  updatedAt: '2022-05-31T16:05:36.603Z'
                  nb_users: 0
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    post:
      tags:
      - Users-Permissions - Users & Roles
      summary: Create a role
      requestBody:
        $ref: '#/components/requestBodies/Users-Permissions-RoleRequest'
      responses:
        '200':
          description: Returns ok if the role was create
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: string
                    enum:
                    - true
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /users-permissions/roles/{id}:
    get:
      tags:
      - Users-Permissions - Users & Roles
      summary: Get a role
      parameters:
      - in: path
        name: id
        required: true
        schema:
          type: string
        description: role Id
      responses:
        '200':
          description: Returns the role
          content:
            application/json:
              schema:
                type: object
                properties:
                  role:
                    $ref: '#/components/schemas/Users-Permissions-Role'
              example:
                role:
                  id: 1
                  name: Public
                  description: Default role given to unauthenticated user.
                  type: public
                  createdAt: '2022-05-19T17:35:35.097Z'
                  updatedAt: '2022-05-31T16:05:36.603Z'
                  permissions:
                    api::content-type.content-type:
                      controllers:
                        controllerA:
                          find:
                            enabled: true
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /users-permissions/roles/{role}:
    put:
      tags:
      - Users-Permissions - Users & Roles
      summary: Update a role
      parameters:
      - in: path
        name: role
        required: true
        schema:
          type: string
        description: role Id
      requestBody:
        $ref: '#/components/requestBodies/Users-Permissions-RoleRequest'
      responses:
        '200':
          description: Returns ok if the role was udpated
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: string
                    enum:
                    - true
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      tags:
      - Users-Permissions - Users & Roles
      summary: Delete a role
      parameters:
      - in: path
        name: role
        required: true
        schema:
          type: string
        description: role Id
      responses:
        '200':
          description: Returns ok if the role was delete
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: string
                    enum:
                    - true
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /users:
    get:
      tags:
      - Users-Permissions - Users & Roles
      summary: Get list of users
      responses:
        '200':
          description: Returns an array of users
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Users-Permissions-User'
              example:
              - id: 9
                username: foao@strapi.io
                email: foao@strapi.io
                provider: local
                confirmed: false
                blocked: false
                createdAt: '2022-06-01T18:32:35.211Z'
                updatedAt: '2022-06-01T18:32:35.217Z'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    post:
      tags:
      - Users-Permissions - Users & Roles
      summary: Create a user
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - username
              - email
              - password
              properties:
                email:
                  type: string
                username:
                  type: string
                password:
                  type: string
            example:
              username: foo
              email: foo@strapi.io
              password: foo-password
      responses:
        '201':
          description: Returns created user info
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/Users-Permissions-User'
                - type: object
                  properties:
                    role:
                      $ref: '#/components/schemas/Users-Permissions-Role'
              example:
                id: 1
                username: foo
                email: foo@strapi.io
                provider: local
                confirmed: false
                blocked: false
                createdAt: '2022-05-19T17:35:35.096Z'
                updatedAt: '2022-05-19T17:35:35.096Z'
                role:
                  id: 1
                  name: X
                  description: Default role given to authenticated user.
                  type: authenticated
                  createdAt: '2022-05-19T17:35:35.096Z'
                  updatedAt: '2022-06-04T07:11:59.551Z'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /users/{id}:
    get:
      tags:
      - Users-Permissions - Users & Roles
      summary: Get a user
      parameters:
      - in: path
        name: id
        required: true
        schema:
          type: string
        description: user Id
      responses:
        '200':
          description: Returns a user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Users-Permissions-User'
              example:
                id: 1
                username: foo
                email: foo@strapi.io
                provider: local
                confirmed: false
                blocked: false
                createdAt: '2022-05-19T17:35:35.096Z'
                updatedAt: '2022-05-19T17:35:35.096Z'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      tags:
      - Users-Permissions - Users & Roles
      summary: Update a user
      parameters:
      - in: path
        name: id
        required: true
        schema:
          type: string
        description: user Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - username
              - email
              - password
              properties:
                email:
                  type: string
                username:
                  type: string
                password:
                  type: string
            example:
              username: foo
              email: foo@strapi.io
              password: foo-password
      responses:
        '200':
          description: Returns updated user info
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/Users-Permissions-User'
                - type: object
                  properties:
                    role:
                      $ref: '#/components/schemas/Users-Permissions-Role'
              example:
                id: 1
                username: foo
                email: foo@strapi.io
                provider: local
                confirmed: false
                blocked: false
                createdAt: '2022-05-19T17:35:35.096Z'
                updatedAt: '2022-05-19T17:35:35.096Z'
                role:
                  id: 1
                  name: X
                  description: Default role given to authenticated user.
                  type: authenticated
                  createdAt: '2022-05-19T17:35:35.096Z'
                  updatedAt: '2022-06-04T07:11:59.551Z'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      tags:
      - Users-Permissions - Users & Roles
      summary: Delete a user
      parameters:
      - in: path
        name: id
        required: true
        schema:
          type: string
        description: user Id
      responses:
        '200':
          description: Returns deleted user info
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/Users-Permissions-User'
              example:
                id: 1
                username: foo
                email: foo@strapi.io
                provider: local
                confirmed: false
                blocked: false
                createdAt: '2022-05-19T17:35:35.096Z'
                updatedAt: '2022-05-19T17:35:35.096Z'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /users/me:
    get:
      tags:
      - Users-Permissions - Users & Roles
      summary: Get authenticated user info
      responses:
        '200':
          description: Returns user info
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Users-Permissions-User'
              example:
                id: 1
                username: foo
                email: foo@strapi.io
                provider: local
                confirmed: false
                blocked: false
                createdAt: '2022-05-19T17:35:35.096Z'
                updatedAt: '2022-05-19T17:35:35.096Z'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /users/count:
    get:
      tags:
      - Users-Permissions - Users & Roles
      summary: Get user count
      responses:
        '200':
          description: Returns a number
          content:
            application/json:
              schema:
                type: number
              example: 1
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  requestBodies:
    Users-Permissions-RoleRequest:
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              name:
                type: string
              description:
                type: string
              type:
                type: string
              permissions:
                $ref: '#/components/schemas/Users-Permissions-PermissionsTree'
          example:
            name: foo
            description: role foo
            permissions:
              api::content-type.content-type:
                controllers:
                  controllerA:
                    find:
                      enabled: true
  schemas:
    Users-Permissions-User:
      type: object
      properties:
        id:
          type: number
          example: 1
        username:
          type: string
          example: foo.bar
        email:
          type: string
          example: foo.bar@strapi.io
        provider:
          type: string
          example: local
        confirmed:
          type: boolean
          example: true
        blocked:
          type: boolean
          example: false
        createdAt:
          type: string
          format: date-time
          example: '2022-06-02T08:32:06.258Z'
        updatedAt:
          type: string
          format: date-time
          example: '2022-06-02T08:32:06.267Z'
    Users-Permissions-Role:
      type: object
      properties:
        id:
          type: number
        name:
          type: string
        description:
          type: string
        type:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Error:
      type: object
      required:
      - error
      properties:
        data:
          oneOf:
          - type: object
          - type: array
            items:
              type: object
        error:
          type: object
          properties:
            status:
              type: integer
            name:
              type: string
            message:
              type: string
            details:
              type: object
    Users-Permissions-PermissionsTree:
      type: object
      additionalProperties:
        type: object
        description: every api
        properties:
          controllers:
            description: every controller of the api
            type: object
            additionalProperties:
              type: object
              additionalProperties:
                description: every action of every controller
                type: object
                properties:
                  enabled:
                    type: boolean
                  policy:
                    type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
externalDocs:
  description: Find out more
  url: https://docs.strapi.io/developer-docs/latest/getting-started/introduction.html
x-strapi-config:
  plugins:
  - upload
  - users-permissions