> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://apidoc.dreamclass.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://apidoc.dreamclass.io/_mcp/server.

# AddRecurringEvent

POST https://dreamclassapi/v1/calendar/event/recurring
Content-Type: application/json

Add recurring event

This API endpoint allows you to add a recurring event by specifying a recurrence rule. The recurrence rule must follow the [iCalendar specification](https://icalendar.org), using the `DTSTART` and `RRULE` elements to define the event's start date and recurrence pattern.

#### Parameters

- rrule: A string defining the start date and recurrence rule, following the iCalendar format. The rule should consist of:
    
    - A `DTSTART` element on the first line, specifying the start date and time of the event.
        
    - An `RRULE` element on the second line, specifying the recurrence pattern (e.g., daily, weekly, monthly).
        

```
Each element should be on a separate line, separated by a newline character (`\n`).

 ```

Reference: https://apidoc.dreamclass.io/dream-class-api/calendar/add-recurring-event

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /dreamclassapi/v1/calendar/event/recurring:
    post:
      operationId: add-recurring-event
      summary: AddRecurringEvent
      description: >-
        Add recurring event


        This API endpoint allows you to add a recurring event by specifying a
        recurrence rule. The recurrence rule must follow the [iCalendar
        specification](https://icalendar.org), using the `DTSTART` and `RRULE`
        elements to define the event's start date and recurrence pattern.


        #### Parameters


        - rrule: A string defining the start date and recurrence rule, following
        the iCalendar format. The rule should consist of:
            
            - A `DTSTART` element on the first line, specifying the start date and time of the event.
                
            - An `RRULE` element on the second line, specifying the recurrence pattern (e.g., daily, weekly, monthly).
                

        ```

        Each element should be on a separate line, separated by a newline
        character (`\n`).

         ```
      tags:
        - subpackage_calendar
      parameters:
        - name: tenant
          in: header
          required: false
          schema:
            type: string
        - name: schoolCode
          in: header
          required: false
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Calendar_AddRecurringEvent_Response_200'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                rrule:
                  type: string
                title:
                  type: string
                duration:
                  type: integer
                semester:
                  $ref: >-
                    #/components/schemas/DreamclassapiV1CalendarEventRecurringPostRequestBodyContentApplicationJsonSchemaSemester
                createdBy:
                  type: string
                  format: email
                description:
                  description: Any type
                visibleToStudents:
                  type: boolean
                visibleToProfessors:
                  type: boolean
              required:
                - rrule
                - title
                - duration
                - semester
                - createdBy
                - visibleToStudents
                - visibleToProfessors
servers:
  - url: https:/
    description: https://{server}
  - url: https://your-webhook-url
    description: https://your-webhook-url
components:
  schemas:
    DreamclassapiV1CalendarEventRecurringPostRequestBodyContentApplicationJsonSchemaSemester:
      type: object
      properties:
        id:
          type: integer
      required:
        - id
      title: >-
        DreamclassapiV1CalendarEventRecurringPostRequestBodyContentApplicationJsonSchemaSemester
    Calendar_AddRecurringEvent_Response_200:
      type: object
      properties:
        id:
          type: integer
        rrule:
          type: string
        title:
          type: string
        duration:
          type: integer
        createdBy:
          type: string
          format: email
        description:
          description: Any type
        visibleToStudents:
          type: boolean
        visibleToProfessors:
          type: boolean
      required:
        - id
        - rrule
        - title
        - duration
        - createdBy
        - visibleToStudents
        - visibleToProfessors
      title: Calendar_AddRecurringEvent_Response_200

```

## Examples



**Request**

```json
{
  "rrule": "DTSTART;TZID=America/New_York:20240901T080000\nRRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR;UNTIL=20241215T170000;INTERVAL=1",
  "title": "Physics 101",
  "duration": 60,
  "semester": {
    "id": 3
  },
  "createdBy": "prof.johnson@university.edu",
  "visibleToStudents": true,
  "visibleToProfessors": true
}
```

**Response**

```json
{
  "id": 42,
  "rrule": "DTSTART;TZID=America/New_York:20240901T080000\nRRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR;UNTIL=20241215T170000;INTERVAL=1",
  "title": "Physics 101",
  "duration": 60,
  "createdBy": "prof.johnson@university.edu",
  "visibleToStudents": true,
  "visibleToProfessors": true
}
```

**SDK Code**

```python Calendar_AddRecurringEvent_example
import requests

url = "https://https/dreamclassapi/v1/calendar/event/recurring"

payload = {
    "rrule": "DTSTART;TZID=America/New_York:20240901T080000
RRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR;UNTIL=20241215T170000;INTERVAL=1",
    "title": "Physics 101",
    "duration": 60,
    "semester": { "id": 3 },
    "createdBy": "prof.johnson@university.edu",
    "visibleToStudents": True,
    "visibleToProfessors": True
}
headers = {
    "tenant": "{{tenant}}",
    "schoolCode": "{{schoolCode}}",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Calendar_AddRecurringEvent_example
const url = 'https://https/dreamclassapi/v1/calendar/event/recurring';
const options = {
  method: 'POST',
  headers: {
    tenant: '{{tenant}}',
    schoolCode: '{{schoolCode}}',
    'Content-Type': 'application/json'
  },
  body: '{"rrule":"DTSTART;TZID=America/New_York:20240901T080000\nRRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR;UNTIL=20241215T170000;INTERVAL=1","title":"Physics 101","duration":60,"semester":{"id":3},"createdBy":"prof.johnson@university.edu","visibleToStudents":true,"visibleToProfessors":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Calendar_AddRecurringEvent_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://https/dreamclassapi/v1/calendar/event/recurring"

	payload := strings.NewReader("{\n  \"rrule\": \"DTSTART;TZID=America/New_York:20240901T080000\\nRRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR;UNTIL=20241215T170000;INTERVAL=1\",\n  \"title\": \"Physics 101\",\n  \"duration\": 60,\n  \"semester\": {\n    \"id\": 3\n  },\n  \"createdBy\": \"prof.johnson@university.edu\",\n  \"visibleToStudents\": true,\n  \"visibleToProfessors\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("tenant", "{{tenant}}")
	req.Header.Add("schoolCode", "{{schoolCode}}")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Calendar_AddRecurringEvent_example
require 'uri'
require 'net/http'

url = URI("https://https/dreamclassapi/v1/calendar/event/recurring")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["tenant"] = '{{tenant}}'
request["schoolCode"] = '{{schoolCode}}'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"rrule\": \"DTSTART;TZID=America/New_York:20240901T080000\\nRRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR;UNTIL=20241215T170000;INTERVAL=1\",\n  \"title\": \"Physics 101\",\n  \"duration\": 60,\n  \"semester\": {\n    \"id\": 3\n  },\n  \"createdBy\": \"prof.johnson@university.edu\",\n  \"visibleToStudents\": true,\n  \"visibleToProfessors\": true\n}"

response = http.request(request)
puts response.read_body
```

```java Calendar_AddRecurringEvent_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://https/dreamclassapi/v1/calendar/event/recurring")
  .header("tenant", "{{tenant}}")
  .header("schoolCode", "{{schoolCode}}")
  .header("Content-Type", "application/json")
  .body("{\n  \"rrule\": \"DTSTART;TZID=America/New_York:20240901T080000\\nRRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR;UNTIL=20241215T170000;INTERVAL=1\",\n  \"title\": \"Physics 101\",\n  \"duration\": 60,\n  \"semester\": {\n    \"id\": 3\n  },\n  \"createdBy\": \"prof.johnson@university.edu\",\n  \"visibleToStudents\": true,\n  \"visibleToProfessors\": true\n}")
  .asString();
```

```php Calendar_AddRecurringEvent_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://https/dreamclassapi/v1/calendar/event/recurring', [
  'body' => '{
  "rrule": "DTSTART;TZID=America/New_York:20240901T080000\\nRRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR;UNTIL=20241215T170000;INTERVAL=1",
  "title": "Physics 101",
  "duration": 60,
  "semester": {
    "id": 3
  },
  "createdBy": "prof.johnson@university.edu",
  "visibleToStudents": true,
  "visibleToProfessors": true
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'schoolCode' => '{{schoolCode}}',
    'tenant' => '{{tenant}}',
  ],
]);

echo $response->getBody();
```

```csharp Calendar_AddRecurringEvent_example
using RestSharp;

var client = new RestClient("https://https/dreamclassapi/v1/calendar/event/recurring");
var request = new RestRequest(Method.POST);
request.AddHeader("tenant", "{{tenant}}");
request.AddHeader("schoolCode", "{{schoolCode}}");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"rrule\": \"DTSTART;TZID=America/New_York:20240901T080000\\nRRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR;UNTIL=20241215T170000;INTERVAL=1\",\n  \"title\": \"Physics 101\",\n  \"duration\": 60,\n  \"semester\": {\n    \"id\": 3\n  },\n  \"createdBy\": \"prof.johnson@university.edu\",\n  \"visibleToStudents\": true,\n  \"visibleToProfessors\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Calendar_AddRecurringEvent_example
import Foundation

let headers = [
  "tenant": "{{tenant}}",
  "schoolCode": "{{schoolCode}}",
  "Content-Type": "application/json"
]
let parameters = [
  "rrule": "DTSTART;TZID=America/New_York:20240901T080000
RRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR;UNTIL=20241215T170000;INTERVAL=1",
  "title": "Physics 101",
  "duration": 60,
  "semester": ["id": 3],
  "createdBy": "prof.johnson@university.edu",
  "visibleToStudents": true,
  "visibleToProfessors": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://https/dreamclassapi/v1/calendar/event/recurring")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```