---
agentTools:
  projectIndex: https://pneumacare.readme.io/llms.txt
---

# Cancel a service order

Cancel a service order

[block:callout]
{
  "type": "warning",
  "title": "This endpoint is authenticated by the public API key"
}
[/block]

[block:callout]
{
  "type": "info",
  "title": "Cancelling a service order",
  "body": "A service order can only be cancelled before it is accepted by a provider."
}
[/block]

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "PneumaCare API",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.pneumahealth.co"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "x-bearer-format": "bearer",
        "x-default": "j72nw6niu527coanz7b8"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/services/orders/{id}/cancel": {
      "patch": {
        "summary": "Cancel a service order",
        "description": "Cancel a service order",
        "operationId": "cancel-a-service-order",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "ID of the service order",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"message\": \"Service order canceled successfully\",\n  \"data\": {\n    \"id\": \"vp0aye239yx38m8\",\n    \"provider\": {\n      \"business_name\": \"Viva Gym\",\n      \"email\": \"service+testings@pneuma.care\",\n      \"phone\": \"09087645321\",\n      \"type\": \"dietitian\"\n    },\n    \"plan\": \"33bl6pn6wdxrz76\",\n    \"status\": \"canceled\",\n    \"number\": 5,\n    \"user\": {\n      \"id\": \"xrph6c5eikr1pwd\",\n      \"first_name\": \"Chikwe\",\n      \"last_name\": \"Ihekweazu\"\n    },\n    \"integration\": \"axa1qk7kmsradh6\",\n    \"mode\": \"sandbox\",\n    \"type\": \"dietitian\",\n    \"total_price\": \"2500000\",\n    \"currency\": \"ngn\",\n    \"created_at\": \"2021-11-24T15:19:16.000Z\",\n    \"updated_at\": \"2021-11-24T19:25:36.000Z\",\n    \"note\": null,\n    \"metadata\": {\n      \"pick_up\": \"My House\"\n    }\n  }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Service order canceled successfully"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "vp0aye239yx38m8"
                        },
                        "provider": {
                          "type": "object",
                          "properties": {
                            "business_name": {
                              "type": "string",
                              "example": "Viva Gym"
                            },
                            "email": {
                              "type": "string",
                              "example": "service+testings@pneuma.care"
                            },
                            "phone": {
                              "type": "string",
                              "example": "09087645321"
                            },
                            "type": {
                              "type": "string",
                              "example": "dietitian"
                            }
                          }
                        },
                        "plan": {
                          "type": "string",
                          "example": "33bl6pn6wdxrz76"
                        },
                        "status": {
                          "type": "string",
                          "example": "canceled"
                        },
                        "number": {
                          "type": "integer",
                          "example": 5,
                          "default": 0
                        },
                        "user": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "example": "xrph6c5eikr1pwd"
                            },
                            "first_name": {
                              "type": "string",
                              "example": "Chikwe"
                            },
                            "last_name": {
                              "type": "string",
                              "example": "Ihekweazu"
                            }
                          }
                        },
                        "integration": {
                          "type": "string",
                          "example": "axa1qk7kmsradh6"
                        },
                        "mode": {
                          "type": "string",
                          "example": "sandbox"
                        },
                        "type": {
                          "type": "string",
                          "example": "dietitian"
                        },
                        "total_price": {
                          "type": "string",
                          "example": "2500000"
                        },
                        "currency": {
                          "type": "string",
                          "example": "ngn"
                        },
                        "created_at": {
                          "type": "string",
                          "example": "2021-11-24T15:19:16.000Z"
                        },
                        "updated_at": {
                          "type": "string",
                          "example": "2021-11-24T19:25:36.000Z"
                        },
                        "note": {},
                        "metadata": {
                          "type": "object",
                          "properties": {
                            "pick_up": {
                              "type": "string",
                              "example": "My House"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"error\": \"Service order not found\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "Service order not found"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "61332d511b787e0026bea8d5:6198ae43c46e590062ab1bef"
}
```