{
    "openapi": "3.0.3",
    "info": {
        "title": "Get Donation Periods",
        "description": "Get donation periods for a race.",
        "version": "1.0.0",
        "contact": {
            "name": "RunSignup API Support",
            "url": "https://runsignup.com/API",
            "email": "info@runsignup.com"
        }
    },
    "servers": [
        {
            "url": "https://api.runsignup.com/rest",
            "description": "Production API Server"
        }
    ],
    "tags": [
        {
            "name": "Donations",
            "description": "APIs related to Donations"
        }
    ],
    "components": {
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "error": {
                        "type": "string",
                        "description": "Error message"
                    },
                    "details": {
                        "type": "object",
                        "description": "Additional error details",
                        "additionalProperties": true
                    }
                },
                "required": [
                    "error"
                ]
            },
            "BadRequestError": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/Error"
                    },
                    {
                        "description": "Error indicating invalid request parameters or structure"
                    }
                ]
            },
            "UnauthorizedError": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/Error"
                    },
                    {
                        "description": "Error indicating authentication failure"
                    }
                ]
            },
            "ForbiddenError": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/Error"
                    },
                    {
                        "description": "Error indicating the authenticated user lacks required permissions"
                    }
                ]
            },
            "NotFoundError": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/Error"
                    },
                    {
                        "description": "Error indicating the requested resource does not exist"
                    }
                ]
            },
            "ServerError": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/Error"
                    },
                    {
                        "description": "Error indicating an unexpected server-side issue"
                    }
                ]
            },
            "V2RaceDonationsGetDonationPeriodsGetResponse": {
                "type": "object",
                "title": "Get Donation Periods Response",
                "description": "List of donation periods for a race",
                "properties": {
                    "donation_periods": {
                        "type": "array",
                        "description": "Donation periods for the race",
                        "items": {
                            "type": "object",
                            "description": "A donation period",
                            "properties": {
                                "donation_period_id": {
                                    "type": "integer",
                                    "description": "Donation period ID"
                                },
                                "start_ts": {
                                    "type": "integer",
                                    "description": "Start timestamp of the donation period"
                                },
                                "end_ts": {
                                    "type": "integer",
                                    "description": "End timestamp of the donation period (null if open-ended)",
                                    "nullable": true
                                }
                            },
                            "required": [
                                "donation_period_id",
                                "start_ts"
                            ]
                        }
                    }
                },
                "required": [
                    "donation_periods"
                ],
                "example": {
                    "donation_periods": [
                        {
                            "donation_period_id": 456,
                            "start_ts": 1767225600,
                            "end_ts": 1798675200
                        },
                        {
                            "donation_period_id": 123,
                            "start_ts": 1735689600,
                            "end_ts": 1767139200
                        }
                    ]
                }
            }
        },
        "securitySchemes": {
            "oauth2": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "JWT",
                "description": "OAuth2 Bearer token authentication. Use the access token obtained from the OAuth2 flow in the Authorization header as: `Authorization: Bearer {access_token}`. For complete OAuth2 implementation details including endpoints, parameters, and flow specifications, see the [OAuth2 Authentication API Specification](https://runsignup.com/API/OAuth2/openapi-spec.json). For client registration and setup guidance, visit the [OAuth2 Developer Guide](https://runsignup.com/Profile/OAuth2/DeveloperGuide)."
            },
            "apiKey": {
                "type": "apiKey",
                "in": "query",
                "name": "api_key",
                "description": "RunSignup API Key"
            },
            "apiSecret": {
                "type": "apiKey",
                "in": "query",
                "name": "api_secret",
                "description": "RunSignup API Secret"
            }
        }
    },
    "paths": {
        "/v2/race-donations/get-donation-periods.json": {
            "get": {
                "tags": [
                    "Donations"
                ],
                "summary": "Get Donation Periods",
                "description": "Get donation periods for a race. This API supports OAuth2 Bearer token authentication.",
                "operationId": "v2_race_donations_get_donation_periods_json",
                "parameters": [
                    {
                        "name": "api_key",
                        "in": "query",
                        "description": "API Key",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "api_secret",
                        "in": "query",
                        "description": "API Secret",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "rsu_api_key",
                        "in": "query",
                        "description": "API v2 key. If used, you must send the API secret in an HTTP header named X-RSU-API-SECRET.",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "sp_api_key",
                        "in": "query",
                        "description": "Super partner API key. If used, you must send the API secret in an HTTP header named X-RSU-API-SECRET.",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "X-RSU-API-SECRET",
                        "in": "header",
                        "description": "API v2 or super partner secret.",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "Authorization",
                        "in": "header",
                        "description": "Authorization Header. If using OAuth 2.0, fill this in with `Bearer <token>`.",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "race_id",
                        "in": "query",
                        "description": "ID of race.",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "security": [
                    {
                        "oauth2": []
                    },
                    {
                        "apiKey": [],
                        "apiSecret": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Get Donation Periods Response - List of donation periods for a race",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/V2RaceDonationsGetDonationPeriodsGetResponse"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BadRequestError"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/UnauthorizedError"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ForbiddenError"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/NotFoundError"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ServerError"
                                }
                            }
                        }
                    }
                },
                "x-permissions": [
                    "partners",
                    "race_directors"
                ]
            }
        }
    }
}