# Delete a function version DELETE /v1/a/adapters/edge/functions/{slug}/{version} Select code sample ``` const url = 'https://example.com/v1/a/adapters/edge/functions/example/1'; const options = {method: 'DELETE', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ``` curl --request DELETE \ --url https://example.com/v1/a/adapters/edge/functions/example/1 \ --header 'Authorization: Bearer ' ``` - /v1/a/adapters/edge/functions/{slug}/{version} Deletes the row, then removes the bundle from the bucket and the local version folder. A run after that gets `404` and cannot rebuild the bundle. If the removal fails, the call is `500` and goes to Sentry with both paths; the row is already gone. A missing local folder is fine, the cache cron may have removed it. Deleting the latest version does not make an older one latest. ## Permission This operation needs the permission [`edge:function:manage`](https://docs.aiva.apifonica.com/concepts/roles-and-permissions/#edge-function-manage). ## Authorizations - **[bearerAuth](https://docs.aiva.apifonica.com/api/account/#bearerauth)** ## Parameters ### Path Parameters **slug** required Function name inside the account. Needs at least one `[A-Za-z0-9_]` character and must not be `by-id`. Other characters are not rejected. string \>= 1 characters <= 100 characters **version** required integer \>= 1 ### Header Parameters **X-Account-Sid** string Target account for principals broader than one account (tenant / account API key); account-scoped principals use their own. ## Responses ### 200 Deleted Media typeapplication/json object **ok** required boolean **deleted** required boolean ##### Example ``` { "ok": true, "deleted": true } ``` ### 400 Domain error. A failed bundle comes as `400` with `err_code: INTERNAL_SERVER_ERROR`. On a run route a bundle that could not be rebuilt is this `400` too. Media typeapplication/json object **ok** required boolean **error** required string **err\_code** required string Allowed values: UNAUTHORIZED FORBIDDEN NOT\_FOUND BAD\_REQUEST INTERNAL\_SERVER\_ERROR VALIDATION\_ERROR ##### Example ``` { "ok": false, "err_code": "UNAUTHORIZED" } ``` ### 401 Unauthorized ### 403 Forbidden ### 404 No version with these keys in the account Media typeapplication/json object **ok** required boolean **error** required string **err\_code** required string Allowed values: UNAUTHORIZED FORBIDDEN NOT\_FOUND BAD\_REQUEST INTERNAL\_SERVER\_ERROR VALIDATION\_ERROR ##### Example ``` { "ok": false, "error": "Function not found", "err_code": "NOT_FOUND" } ``` ### 422 The body, query or path params did not pass the zod schema Media typeapplication/json object **ok** required boolean **error** required string Allowed values: Validation failed **issues** required Zod issues as is Array\ object **code** required string **path** required Array **message** required string ##### Example ``` { "ok": false, "error": "Validation failed" } ``` ### 500 Unexpected error, for example a database or a disk failure. The body has `err_code: INTERNAL_SERVER_ERROR`. Media typeapplication/json object **ok** required boolean **error** required string **err\_code** required string Allowed values: UNAUTHORIZED FORBIDDEN NOT\_FOUND BAD\_REQUEST INTERNAL\_SERVER\_ERROR VALIDATION\_ERROR ##### Example ``` { "ok": false, "err_code": "UNAUTHORIZED" } ``` ### 502 Bad gateway (upstream adapter error)