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

# Integration Change State

> Endpoint to change the state of a specific GPT integration.
Allows admin users to transition an integration to a new lifecycle state (e.g., DRAFT, PUBLISHED).

Args:
    gpt_name (str): The name of the integration (typically aligned with a GPT name).
    new_state (States): The new target state to apply to the integration (default is `DRAFT`).

Returns:
    dict: A success message confirming the state change.

Raises:
    HTTPException 404: If the integration with the specified name does not exist.
    HTTPException 500: If any error occurs during the update process.



## OpenAPI

````yaml patch /api/integration/{gpt_name}/change_state
openapi: 3.1.0
info:
  title: Apigene
  description: Apigene API
  version: 1.0.0
  contact:
    name: Apigene Support
    url: https://app.apigene.ai
    email: support@apigene.ai
servers:
  - url: https://app.apigene.ai
security:
  - BearerAuth: []
paths:
  /api/integration/{gpt_name}/change_state:
    patch:
      tags:
        - Integration
      summary: Integration Change State
      description: >-
        Endpoint to change the state of a specific GPT integration.

        Allows admin users to transition an integration to a new lifecycle state
        (e.g., DRAFT, PUBLISHED).


        Args:
            gpt_name (str): The name of the integration (typically aligned with a GPT name).
            new_state (States): The new target state to apply to the integration (default is `DRAFT`).

        Returns:
            dict: A success message confirming the state change.

        Raises:
            HTTPException 404: If the integration with the specified name does not exist.
            HTTPException 500: If any error occurs during the update process.
      operationId: integration_change_state
      parameters:
        - name: gpt_name
          in: path
          required: true
          schema:
            type: string
            title: Gpt Name
        - name: new_state
          in: query
          required: false
          schema:
            type: string
            description: Integration state.
            default: draft
            title: New State
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Authorization header using the Bearer scheme. Example:
        'Authorization: Bearer {token}'

````