---
title: "Sets a new state for an organization"
url: "https://nov18-dev.movespot.fyi/apis/konnect-organization-lifecycle-internal-0/versions/ceb69d5d-e7de-4a49-9871-858ce749e2b7/operations/post-organization-state"
---

> Full API specification: https://nov18-dev.movespot.fyi/apis/konnect-organization-lifecycle-internal-0/versions/ceb69d5d-e7de-4a49-9871-858ce749e2b7.md

# Sets a new state for an organization

`POST` `/organizations/state`

Operation ID: `post-organization-state`

Sets a new state for an organization and creates an organization state history record. An organization can be set to active or inactive.

## Request body (required)

Content types: `application/json`

## Responses

- `201` - A response for setting the organization state.
- `400` - Bad Request
- `401` - Unauthorized
- `403` - Forbidden
- `404` - Not Found
- `409` - Conflict

## OpenAPI definition

```yaml
openapi: 3.0.2
info:
  title: Konnect Organization Lifecycle
  version: 0.0.1
servers:
  - url: https://global.api.konghq.com/v3
    description: Global Base URL
paths:
  /organizations/state:
    post:
      operationId: post-organization-state
      summary: Sets a new state for an organization
      description: |
        Sets a new state for an organization and creates an organization state 
        history record. An organization can be set to active or inactive.
      requestBody:
        $ref: "#/components/requestBodies/UpdateOrganizationState"
      responses:
        "201":
          $ref: "#/components/responses/OrganizationStateResponse"
        "400":
          $ref: "#/components/responses/OrganizationStateBadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/OrganizationNotFound"
        "409":
          $ref: "#/components/responses/OrganizationStateConflict"
      tags:
        - Organization Lifecycle
components:
  requestBodies:
    UpdateOrganizationState:
      required: true
      description: The request schema to set an organization's state.
      content:
        application/json:
          schema:
            type: object
            properties:
              state:
                description: The state of the organization to set.
                type: string
                example: inactive
                enum:
                  - active
                  - inactive
                  - deleting
                  - deleted
              reason:
                description: The reason for the state change.
                type: string
                example: invoice overdue (30 days)
              changed_by:
                description: The uuid of the konger who modified the state.
                type: string
                example: 00uerwcs8eC4ifanR256
            required:
              - state
          examples:
            Inactive Example:
              value:
                state: inactive
                reason: invoice overdue (30 days)
                changed_by: 00uerwcs8eC4ifanR256
            Active Example:
              value:
                state: active
                reason: organization was created
  responses:
    OrganizationStateResponse:
      description: A response for setting the organization state.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/OrganizationState"
          examples:
            Example:
              value:
                id: d99c041a-c7cf-46a2-bf3a-44bb5f75400e
                state: active
                reason: invoice overdue (30 days)
                service: kadmin
                changed_by: 00uerwcs8eC4ifanR256
                created_at: 2023-01-18T11:35:45.130Z
    OrganizationStateBadRequest:
      description: Bad Request
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/BadRequestError"
          examples:
            Request format is invalid:
              $ref: "#/components/examples/400InvalidRequestFormat"
    Unauthorized:
      description: Unauthorized
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/UnauthorizedError"
          examples:
            UnauthorizedExample:
              $ref: "#/components/examples/UnauthorizedExample"
    Forbidden:
      description: Forbidden
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/ForbiddenError"
          examples:
            UnauthorizedExample:
              $ref: "#/components/examples/ForbiddenExample"
    OrganizationNotFound:
      description: Not Found
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/NotFoundError"
          examples:
            Not Found:
              $ref: "#/components/examples/404OrganizationStateNotFound"
    OrganizationStateConflict:
      description: Conflict
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/ConflictError"
          examples:
            Conflict:
              $ref: "#/components/examples/409OrganizationStateConflict"
  schemas:
    OrganizationState:
      type: object
      properties:
        id:
          description: UUID of the organization.
          type: string
          format: uuid
          example: d99c041a-c7cf-46a2-bf3a-44bb5f75400e
          readOnly: true
        state:
          description: State of the organization.
          type: string
          example: active
          enum:
            - active
            - inactive
            - deleting
            - deleted
        reason:
          description: The reason for the organization's state.
          type: string
          example: invoice overdue (30 days)
        service:
          description: The service that modified the state.
          type: string
          example: kbilling
        changed_by:
          description: |
            The ID of the Konger who modified the state.
          type: string
          example: 00uerwcs8eC4ifanR256
        created_at:
          description: Date the organization state was created.
          type: string
          format: date-time
          example: 2023-01-23T17:22:52.150Z
          readOnly: true
      title: Organization State
    BadRequestError:
      allOf:
        - $ref: "#/components/schemas/BaseError"
        - type: object
          required:
            - invalid_parameters
          properties:
            invalid_parameters:
              $ref: "#/components/schemas/InvalidParameters"
    UnauthorizedError:
      allOf:
        - $ref: "#/components/schemas/BaseError"
        - type: object
          properties:
            status:
              example: 401
            title:
              example: Unauthorized
            type:
              example: https://httpstatuses.com/401
            instance:
              example: kong:trace:1234567890
            detail:
              example: Invalid credentials
    ForbiddenError:
      allOf:
        - $ref: "#/components/schemas/BaseError"
        - type: object
          properties:
            status:
              example: 403
            title:
              example: Forbidden
            type:
              example: https://httpstatuses.com/403
            instance:
              example: kong:trace:1234567890
            detail:
              example: Forbidden
    NotFoundError:
      allOf:
        - $ref: "#/components/schemas/BaseError"
        - type: object
          properties:
            status:
              example: 404
            title:
              example: Not Found
            type:
              example: https://httpstatuses.com/404
            instance:
              example: kong:trace:1234567890
            detail:
              example: Not found
    ConflictError:
      allOf:
        - $ref: "#/components/schemas/BaseError"
        - type: object
          properties:
            status:
              example: 409
            title:
              example: Conflict
            type:
              example: https://httpstatuses.com/409
            instance:
              example: kong:trace:1234567890
            detail:
              example: Conflict
    BaseError:
      description: standard error
      type: object
      properties:
        status:
          description: >
            The HTTP status code of the error. Useful when passing the response

            body to child properties in a frontend UI. Must be returned as an
            integer.
          type: integer
          readOnly: true
        title:
          description: |
            A short, human-readable summary of the problem. It should not
            change between occurences of a problem, except for localization.
            Should be provided as "Sentence case" for direct use in the UI.
          type: string
          readOnly: true
        type:
          description: The error type.
          type: string
          readOnly: true
        instance:
          description: |
            Used to return the correlation ID back to the user, in the format
            kong:trace:<correlation_id>. This helps us find the relevant logs
            when a customer reports an issue.
          type: string
          readOnly: true
        detail:
          description: >
            A human readable explanation specific to this occurence of the
            problem.

            This field may contain request/entity data to help the user
            understand

            what went wrong. Enclose variable values in square brackets. Should
            be

            provided as "Sentence case" for direct use in the UI.
          type: string
          readOnly: true
      required:
        - status
        - title
        - instance
        - detail
      title: Error
    InvalidParameters:
      description: invalid parameters
      type: array
      items:
        oneOf:
          - $ref: "#/components/schemas/InvalidParameterStandard"
          - $ref: "#/components/schemas/InvalidParameterMinimumLength"
          - $ref: "#/components/schemas/InvalidParameterMaximumLength"
          - $ref: "#/components/schemas/InvalidParameterChoiceItem"
          - $ref: "#/components/schemas/InvalidParameterDependentItem"
      minItems: 1
      nullable: false
      uniqueItems: true
    InvalidParameterStandard:
      type: object
      properties:
        field:
          type: string
          example: name
          readOnly: true
        rule:
          $ref: "#/components/schemas/InvalidRules"
        source:
          type: string
          example: body
        reason:
          type: string
          example: is a required field
          readOnly: true
      additionalProperties: false
      required:
        - field
        - reason
    InvalidParameterMinimumLength:
      type: object
      properties:
        field:
          type: string
          example: name
          readOnly: true
        rule:
          description: invalid parameters rules
          type: string
          enum:
            - min_length
            - min_digits
            - min_lowercase
            - min_uppercase
            - min_symbols
            - min_items
            - min
          nullable: false
          readOnly: true
        minimum:
          type: integer
          example: 8
        source:
          type: string
          example: body
        reason:
          type: string
          example: must have at least 8 characters
          readOnly: true
      additionalProperties: false
      required:
        - field
        - reason
        - rule
        - minimum
    InvalidParameterMaximumLength:
      type: object
      properties:
        field:
          type: string
          example: name
          readOnly: true
        rule:
          description: invalid parameters rules
          type: string
          enum:
            - max_length
            - max_items
            - max
          nullable: false
          readOnly: true
        maximum:
          type: integer
          example: 8
        source:
          type: string
          example: body
        reason:
          type: string
          example: must not have more than 8 characters
          readOnly: true
      additionalProperties: false
      required:
        - field
        - reason
        - rule
        - maximum
    InvalidParameterChoiceItem:
      type: object
      properties:
        field:
          type: string
          example: name
          readOnly: true
        rule:
          description: invalid parameters rules
          type: string
          enum:
            - enum
          nullable: false
          readOnly: true
        reason:
          type: string
          example: is a required field
          readOnly: true
        choices:
          type: array
          items: {}
          minItems: 1
          nullable: false
          readOnly: true
          uniqueItems: true
        source:
          type: string
          example: body
      additionalProperties: false
      required:
        - field
        - reason
        - rule
        - choices
    InvalidParameterDependentItem:
      type: object
      properties:
        field:
          type: string
          example: name
          readOnly: true
        rule:
          description: invalid parameters rules
          type: string
          enum:
            - dependent_fields
          nullable: true
          readOnly: true
        reason:
          type: string
          example: is a required field
          readOnly: true
        dependents:
          type: array
          items: {}
          nullable: true
          readOnly: true
          uniqueItems: true
        source:
          type: string
          example: body
      additionalProperties: false
      required:
        - field
        - rule
        - reason
        - dependents
    InvalidRules:
      description: invalid parameters rules
      type: string
      enum:
        - required
        - is_array
        - is_base64
        - is_boolean
        - is_date_time
        - is_integer
        - is_null
        - is_number
        - is_object
        - is_string
        - is_uuid
        - is_fqdn
        - is_arn
        - unknown_property
        - missing_reference
        - is_label
        - matches_regex
        - invalid
        - is_supported_network_availability_zone_list
        - is_supported_network_cidr_block
        - is_supported_provider_region
        - type
      nullable: true
      readOnly: true
  examples:
    400InvalidRequestFormat:
      value:
        status: 400
        title: Bad Request
        instance: konnect:trace:3674017986744198214
        invalid_parameters:
          - field: body
            reason: request format is invalid
        detail: The request format is invalid
    UnauthorizedExample:
      value:
        status: 401
        title: Unauthorized
        instance: kong:trace:8347343766220159418
        detail: Unauthorized
    ForbiddenExample:
      value:
        status: 403
        title: Forbidden
        instance: kong:trace:2723154947768991354
        detail: You do not have permission to perform this action
    404OrganizationStateNotFound:
      value:
        status: 404
        title: Not Found
        instance: konnect:trace:2287285207635123011
        detail: The requested organization was not found
    409OrganizationStateConflict:
      value:
        status: 409
        title: Conflict
        instance: konnect:trace:2287285207635123011
        detail: Organization is already set to the requested state
```
