---
agentTools:
  projectIndex: https://docs.oncallhealth.io/llms.txt
---

# Create a new availability

Create a new appointment availability for a provider

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "oncall",
    "version": "1.2"
  },
  "servers": [
    {
      "url": "https://api.oncallhealth.ca"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://example.com/oauth2/token",
            "scopes": {}
          }
        }
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/appointmentavailabilities/": {
      "post": {
        "summary": "Create a new availability",
        "description": "Create a new appointment availability for a provider",
        "operationId": "create-an-availability",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "available",
                  "duration",
                  "starts_at",
                  "starts_at_timezone",
                  "provider",
                  "rrule"
                ],
                "properties": {
                  "available": {
                    "type": "boolean",
                    "description": "Whether the Appointment Availability should appear in the calendar"
                  },
                  "duration": {
                    "type": "integer",
                    "description": "How long (in minutes) the availability should last.",
                    "format": "int32"
                  },
                  "starts_at": {
                    "type": "string",
                    "description": "The datetime at which the availability should begin.",
                    "format": "date"
                  },
                  "starts_at_timezone": {
                    "type": "string",
                    "description": "The timezone in which you would like to set availability."
                  },
                  "provider": {
                    "type": "string",
                    "description": "The URL of the provider. This will be in the form of https://api.oncallhealth.ca/providers/{provider_id}/ and can be obtained using the Providers API."
                  },
                  "rrule": {
                    "type": "string",
                    "description": "A recurrence rule determining the frequency (which must be WEEKLY), number of recurrences (which must be an integer), and days of the week (which must be SU, MO, TU, WE, TH, FR, or SA) the availability record in question applies to."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"id\": 2,\n    \"available\": true,\n    \"duration\": 60,\n    \"provider\": \"https://api.oncallhealth.ca/providers/1/\",\n    \"starts_at\": \"2021-07-07T17:00:00Z\",\n    \"starts_at_timezone\": \"UTC\",\n    \"rrule\": \"FREQ=WEEKLY;COUNT=1;BYDAY=TU\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer",
                      "example": 2,
                      "default": 0
                    },
                    "available": {
                      "type": "boolean",
                      "example": true,
                      "default": true
                    },
                    "duration": {
                      "type": "integer",
                      "example": 60,
                      "default": 0
                    },
                    "provider": {
                      "type": "string",
                      "example": "https://api.oncallhealth.ca/providers/1/"
                    },
                    "starts_at": {
                      "type": "string",
                      "example": "2021-07-07T17:00:00Z"
                    },
                    "starts_at_timezone": {
                      "type": "string",
                      "example": "UTC"
                    },
                    "rrule": {
                      "type": "string",
                      "example": "FREQ=WEEKLY;COUNT=1;BYDAY=TU"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "language": "curl",
              "code": "curl --request POST 'https://api.oncallhealth.ca/appointmentavailabilities/' \\\n--header 'Authorization: Token YOUR_PROVIDER_TOKEN' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n\t\"available\": true,\n\t\"duration\": 60,\n  \"starts_at\": \"2021-07-08T13:00:00Z\",\n  \"provider\": \"https://api.oncallhealth.ca/providers/1/\",\n  \"starts_at_timezone\": \"UTC\",\n  \"rrule\": \"FREQ=WEEKLY;COUNT=1;BYDAY=TU\"\n}'"
            }
          ],
          "samples-languages": [
            "curl"
          ]
        }
      }
    }
  },
  "x-readme": {
    "headers": [
      {
        "key": "Authorization",
        "value": "Token YOUR_PROVIDER_TOKEN"
      }
    ],
    "explorer-enabled": false,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "62e03e9f2e494c003d6f7e00:62e03e9f2e494c003d6f7e52"
}
```