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

# Cancel Formation

> Cancel a company formation process.

# Cancel Company Formation

This endpoint allows you to cancel a company formation that is in progress. The formation can be canceled using either the company ID or the external ID provided during creation.

## Headers

| Parameter | Type   | Description                  |
| --------- | ------ | ---------------------------- |
| X-API-KEY | string | Formation API Key (required) |

## Path Parameters

| Parameter | Type   | Description                                         | Required |
| --------- | ------ | --------------------------------------------------- | -------- |
| id        | string | Company ID (ObjectID) or External ID (max 64 chars) | Yes      |

### Parameter Examples

* **Company ID**: `64b8f1a2e4b0c8d9f0123456`
* **External ID**: `your-unique-id-123`

## Response

### Success Response (200)

```json theme={null}
{
  "success": true,
  "message": "Formation cancelled successfully",
  "data": {
    "formation_id": "64b8f1a2e4b0c8d9f0123456",
    "company_id": "64b8f1a2e4b0c8d9f0123456",
    "status": "cancelled",
    "external_id": "your-unique-id-123"
  },
  "error": null
}
```

### Response Parameters

| Parameter          | Type    | Description                                |
| ------------------ | ------- | ------------------------------------------ |
| success            | boolean | Indicates if the operation was successful  |
| message            | string  | Additional information about the operation |
| data               | object  | Response data for successful requests      |
| data.formation\_id | string  | Unique formation process ID                |
| data.company\_id   | string  | Unique identifier for the company          |
| data.status        | string  | Updated status of the company formation    |
| data.external\_id  | string  | Your provided external ID (if any)         |

## Error Responses

### Invalid Request - Bad ID Parameter (400)

```json theme={null}
{
  "success": false,
  "message": "Invalid request data",
  "data": null,
  "error": {
    "code": "INVALID_REQUEST",
    "details": "Invalid ID parameter format"
  }
}
```

### Unauthorized - Invalid API Key (401)

```json theme={null}
{
  "success": false,
  "message": "API key is required",
  "data": null,
  "error": {
    "code": "API_KEY_REQUIRED"
  }
}
```

### Formation Not Found (404)

```json theme={null}
{
  "success": false,
  "message": "Company not found",
  "data": null,
  "error": {
    "code": "COMPANY_NOT_FOUND"
  }
}
```

### Internal Server Error (500)

```json theme={null}
{
  "success": false,
  "message": "Internal server error",
  "data": null,
  "error": {
    "code": "INTERNAL_ERROR"
  }
}
```

## Notes

* Only formations that are not yet completed can be canceled
* Once a formation is canceled, it cannot be resumed
* Any fees paid may be subject to the refund policy
* The formation status will be updated to `cancelled`


## OpenAPI

````yaml DELETE /formations/{id}
openapi: 3.0.3
info:
  title: Clemta Formation API
  description: >-
    API for company formation services. This API allows partners to create,
    retrieve, and manage company formations programmatically.
  version: '2025-06-24'
  contact:
    name: Clemta API Support
    email: tech@clemta.com
  license:
    name: Proprietary
    url: https://clemta.com/terms
servers:
  - url: https://api.clemta.com
    description: Production server
  - url: https://sandbox.clemta.com
    description: Sandbox server
security:
  - ApiKeyAuth: []
paths:
  /formations/{id}:
    delete:
      tags:
        - Formation
      summary: Cancel Formation
      description: >-
        Cancels a company formation. The ID can be either the company ID or the
        external ID provided during creation.
      operationId: cancelFormation
      parameters:
        - name: id
          in: path
          required: true
          description: Company ID (ObjectID) or External ID
          schema:
            type: string
            maxLength: 64
            example: 64b8f1a2e4b0c8d9f0123456
      responses:
        '200':
          description: Formation cancelled successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FormationResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '404':
          description: Formation not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
components:
  schemas:
    FormationResponse:
      type: object
      required:
        - success
        - message
      properties:
        success:
          type: boolean
          description: Indicates if the request was successful
        message:
          type: string
          description: Response message
        data:
          type: object
          nullable: true
          description: Response data for successful requests
          properties:
            formation_id:
              type: string
              description: Unique formation process ID
            company_id:
              type: string
              description: Created company ID
            status:
              type: string
              description: Formation status
              enum:
                - shareholder_verification
                - in_progress
                - active
                - refunded
                - name_change
                - signature_requested
                - submitted_to_state
                - cancelled
            external_id:
              type: string
              description: Partner's external ID for this formation
        error:
          type: object
          nullable: true
          description: Error details for failed requests
          properties:
            code:
              type: string
              description: Error code
              enum:
                - API_KEY_REQUIRED
                - INVALID_API_KEY
                - ACCESS_DENIED
                - RATE_LIMIT_EXCEEDED
                - INVALID_REQUEST
                - VALIDATION_FAILED
                - COMPANY_NOT_FOUND
                - PACKAGE_NOT_FOUND
                - DUPLICATE_EXTERNAL_ID
                - INTERNAL_ERROR
            details:
              type: string
              description: Additional error details
    BadRequestError:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          example: Invalid request data
        data:
          type: object
          nullable: true
          example: null
        error:
          type: object
          properties:
            code:
              type: string
              example: INVALID_REQUEST
            details:
              type: string
              example: Field 'name' is required
    UnauthorizedError:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          example: API key is required
        data:
          type: object
          nullable: true
          example: null
        error:
          type: object
          properties:
            code:
              type: string
              example: API_KEY_REQUIRED
            details:
              type: string
              example: ''
    NotFoundError:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          example: Company not found
        data:
          type: object
          nullable: true
          example: null
        error:
          type: object
          properties:
            code:
              type: string
              example: COMPANY_NOT_FOUND
            details:
              type: string
              example: ''
    InternalServerError:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          example: Internal server error
        data:
          type: object
          nullable: true
          example: null
        error:
          type: object
          properties:
            code:
              type: string
              example: INTERNAL_ERROR
            details:
              type: string
              example: An unexpected error occurred.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Formation API key for authentication.

````