> ## Documentation Index
> Fetch the complete documentation index at: https://docs.diversion.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Rename organization

> Change the name of an organization. Only admins can perform this action.



## OpenAPI

````yaml patch /organizations/{org_id}
openapi: 3.0.3
info:
  title: Diversion Core API
  description: >-
    Definition of the Core API used to access low-level functionality of
    Diversion
  version: 0.2.0
servers:
  - url: https://api.diversion.dev/v0
    description: Base endpoint
security: []
paths:
  /organizations/{org_id}:
    parameters:
      - $ref: '#/components/parameters/OrgParam'
    patch:
      tags:
        - Organization Management
      summary: Rename organization
      description: Change the name of an organization. Only admins can perform this action.
      operationId: src.handlersv2.organization.rename_organization
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RenameOrganizationPayload'
      responses:
        '200':
          description: Organization renamed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Organization'
        '404':
          description: Organization not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        default:
          $ref: '#/components/responses/Error'
      security:
        - OAuth2:
            - coreapi/write
components:
  parameters:
    OrgParam:
      in: path
      name: org_id
      schema:
        type: string
      required: true
      description: An ID of an organization
  schemas:
    RenameOrganizationPayload:
      type: object
      properties:
        name:
          type: string
          description: New name for the organization
          example: New Organization Name
          minLength: 1
          maxLength: 128
      required:
        - name
    Organization:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the organization
          example: org_123456
        name:
          type: string
          description: Name of the organization
          example: Example Organization
        description:
          type: string
          description: Description of the organization
          example: This is an example organization.
        owner_id:
          type: string
          description: ID of the user who owns the organization
          example: user_123456
        total_storage:
          type: integer
          description: Total storage allocated to the organization
          example: 1000000
        members:
          type: array
          items:
            $ref: '#/components/schemas/OrganizationMember'
          description: List of members in the organization
        invites:
          type: array
          items:
            $ref: '#/components/schemas/OrganizationInvite'
          description: List of invites sent by the organization
        in_warning_group:
          type: boolean
          description: Whether the organization is in the warning group
          example: true
      required:
        - id
        - name
        - owner_id
        - total_storage
    Error:
      type: object
      properties:
        status:
          type: integer
          description: HTTP status code
        detail:
          type: string
        title:
          type: string
        type:
          type: string
      required:
        - status
        - detail
    OrganizationMember:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the organization member
          example: member_123456
        user_id:
          type: string
          description: ID of the user who is a member of the organization
          example: user_123456
        organization_id:
          type: string
          description: ID of the organization
          example: org_123456
        role:
          $ref: '#/components/schemas/AccessMode'
      required:
        - id
        - user_id
        - organization_id
        - role
    OrganizationInvite:
      type: object
      properties:
        id:
          type: integer
          description: Unique identifier for the organization invite
          example: 123456
        organization_id:
          type: string
          description: ID of the organization
          example: org_123456
        organization_name:
          type: string
          description: Name of the organization
          example: Great Organization
        inviting_user_id:
          type: string
          description: ID of the user who is inviting to the organization
          example: user_123456
        inviting_user_name:
          type: string
          description: Name of the user who is inviting to the organization
          example: John Doe
        invited_email:
          type: string
          format: email
          description: Email of the user who is invited to the organization
          example: john.doe@example.com
        role:
          $ref: '#/components/schemas/AccessMode'
        status:
          $ref: '#/components/schemas/InviteStatus'
        created:
          type: string
          format: date-time
          description: Date and time when the invite was created
          example: '2023-01-01T00:00:00Z'
        expires:
          type: string
          format: date-time
          description: Date and time when the invite expires
          example: '2023-01-31T00:00:00Z'
    AccessMode:
      type: string
      enum:
        - READ
        - WRITE
        - ADMIN
        - OWNER
    InviteStatus:
      type: string
      enum:
        - PENDING
        - ACCEPTED
        - REJECTED
        - CANCELED
  responses:
    Error:
      description: An error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    OAuth2:
      type: oauth2
      x-tokenInfoFunc: src.token_info.token_auth
      description: This API uses OAuth 2 with the implicit grant flow
      flows:
        implicit:
          authorizationUrl: https://auth.diversion.dev/oauth2/authorize
          scopes:
            coreapi/read: Operations with no possible side-effects
            coreapi/write: Modifying operations
            coreapi/admin: >-
              Organizational operations like adding a repo or changing repo
              properties

````