> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # delete > Delete a subproject. Delete a subproject. ### Schema ```yaml openapi: 3.1.0 info: title: API version: 1.0.0 paths: /api/projects/{id}: delete: operationId: subpackageProjects_delete_subproject summary: Delete a project description: >- Deletes a project. With a project API token, only subprojects can be deleted; targeting the root project returns `422 only_subprojects_can_be_deleted`. With a Personal access token, a root project can be deleted as well. In both cases the project must be empty first: remove its subprojects (`subprojects_must_be_removed`) and its phone numbers (`phone_numbers_must_be_removed`). The last remaining project in a space cannot be deleted (`last_project_cannot_be_deleted`). On a successful subproject delete, the subproject's registry brands and campaigns are migrated up to the parent project. Use this operation only for a project that is ready to retire. The Compatibility API cannot close an account; its [Update account](/docs/compatibility-api/rest/accounts/update-account) operation only renames one, so deleting the project here is the API path for retiring it. #### Permissions With a project API token, the token must have the following scope(s) enabled to make a successful request: _Management_. With a [Personal access token](/docs/apis/authorization#personal-access-tokens) there are no scopes. The token holder must be an owner or admin of the space, and the request reaches only the projects the holder is enabled for, plus their subprojects. [Learn more about API scopes](/docs/platform/your-signalwire-api-space). tags: - subpackage_projects parameters: - name: id in: path description: The unique identifier of the project or subproject. required: true schema: $ref: '#/components/schemas/uuid' responses: '204': description: >- There is no content to send for this request, but the headers may be useful. content: application/json: schema: type: object properties: {} '401': description: Access is unauthorized. content: application/json: schema: $ref: '#/components/schemas/Types.StatusCodes.StatusCode401' '404': description: The server cannot find the requested resource. content: application/json: schema: $ref: '#/components/schemas/Types.StatusCodes.StatusCode404' '422': description: >- The request could not be processed. Deleting a root project with a project API token returns `only_subprojects_can_be_deleted`. Deleting a project that still has subprojects returns `subprojects_must_be_removed`, one that still has phone numbers returns `phone_numbers_must_be_removed`, and the last project in a space returns `last_project_cannot_be_deleted`. content: application/json: schema: $ref: '#/components/schemas/Projects.DeleteProjectStatusCode422' '500': description: An internal server error occurred. content: application/json: schema: $ref: '#/components/schemas/Types.StatusCodes.StatusCode500' tags: - name: subpackage_projects servers: - url: https://%7BYour_Space_Name%7D.signalwire.com description: SignalWire API components: schemas: uuid: type: string format: uuid description: Universal Unique Identifier. title: uuid TypesStatusCodesStatusCode401Error: type: string enum: - Unauthorized title: TypesStatusCodesStatusCode401Error Types.StatusCodes.StatusCode401: type: object properties: error: $ref: '#/components/schemas/TypesStatusCodesStatusCode401Error' required: - error description: Access is unauthorized. title: Types.StatusCodes.StatusCode401 TypesStatusCodesStatusCode404Error: type: string enum: - Not Found title: TypesStatusCodesStatusCode404Error Types.StatusCodes.StatusCode404: type: object properties: error: $ref: '#/components/schemas/TypesStatusCodesStatusCode404Error' required: - error description: The server cannot find the requested resource. title: Types.StatusCodes.StatusCode404 Types.StatusCodes.RestApiErrorItem: type: object properties: type: type: string description: The category of error. code: type: string description: A specific error code. message: type: string description: A description of what caused the error. attribute: type: - string - 'null' description: The request parameter that caused the error, if applicable. url: type: string description: A link to documentation about this error. required: - type - code - message - url description: Details about a specific error. title: Types.StatusCodes.RestApiErrorItem Projects.DeleteProjectStatusCode422: type: object properties: errors: type: array items: $ref: '#/components/schemas/Types.StatusCodes.RestApiErrorItem' description: List of validation errors. required: - errors description: >- The request could not be processed. Deleting a root project with a project API token returns `only_subprojects_can_be_deleted`. Deleting a project that still has subprojects returns `subprojects_must_be_removed`, one that still has phone numbers returns `phone_numbers_must_be_removed`, and the last project in a space returns `last_project_cannot_be_deleted`. title: Projects.DeleteProjectStatusCode422 TypesStatusCodesStatusCode500Error: type: string enum: - Internal Server Error title: TypesStatusCodesStatusCode500Error Types.StatusCodes.StatusCode500: type: object properties: error: $ref: '#/components/schemas/TypesStatusCodesStatusCode500Error' required: - error description: An internal server error occurred. title: Types.StatusCodes.StatusCode500 ``` ## **Example** ```typescript {9} import { RestClient } from "@signalwire/sdk"; const client = new RestClient({ project: "your-project-id", token: "your-api-token", host: "your-space.signalwire.com" }); await client.projects.delete("project-id"); ``` > Delete a subproject.