Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.
openapi: 3.2.0
info:
title: Paņem brīvdienu Optimize API
version: '1'
summary: Latvian public holidays, time-off planning and annual leave estimates.
description: 'Calendars cover 2026 and 2027 and assume a Monday-to-Friday workweek. The API is open without a key: anonymous clients get 10 requests per second with a burst of 20. An API key (request one through the site''s contact form) raises that to 100 per second with a burst of 200. JSON request bodies are limited to 64 KiB.'
contact:
name: SIA Valksor
url: https://panembrivdienu.lv/en#contact
license:
name: BSD-3-Clause
identifier: BSD-3-Clause
servers:
- url: https://panembrivdienu.lv
security:
- {}
- apiKey: []
tags:
- name: Optimize
paths:
/api/v1/optimize:
post:
operationId: optimizeLeave
summary: Find leave that bridges days off
description: Lists up to ten breaks, best first. Each break takes every working day between two or more runs of weekends and holidays and joins them, using at most pto_days leave days on its own. Every break holds a holiday or other day off on a weekday; a week that only joins two weekends is not listed. Breaks are ranked by days off, then fewer leave days, then date. Leave days are never before today in Latvian time or before employment_start_date, and a break around New Year counts the next year's holidays.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/OptimizeRequest'
example:
year: 2027
pto_days: 10
responses:
'200':
description: Breaks, best first.
content:
application/json:
schema:
$ref: '#/components/schemas/OptimizeResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/InvalidAPIKey'
'405':
$ref: '#/components/responses/MethodNotAllowed'
'413':
$ref: '#/components/responses/RequestTooLarge'
'429':
$ref: '#/components/responses/TooManyRequests'
tags:
- Optimize
components:
schemas:
CalendarStatistics:
type: object
required:
- year
- total_days
- working_days
- weekend_days
- holidays
- moved_working_days
- moved_days_off
- total_potential_days_off
properties:
year:
type: integer
total_days:
type: integer
working_days:
type: integer
weekend_days:
type: integer
holidays:
type: integer
moved_working_days:
type: integer
moved_days_off:
type: integer
total_potential_days_off:
type: integer
description: Weekends, holidays and transferred days off.
Opportunity:
type: object
required:
- start_date
- end_date
- pto_days
- pto_hours
- total_days_off
- efficiency
- description
properties:
start_date:
$ref: '#/components/schemas/Date'
end_date:
$ref: '#/components/schemas/Date'
pto_days:
type: array
description: The leave days to take.
items:
$ref: '#/components/schemas/Date'
pto_hours:
type: integer
description: Working hours of leave, assuming a full-time 8-hour day; 7 hours on a pre-holiday day.
total_days_off:
type: integer
efficiency:
type: number
description: Days off per leave day.
description:
type: string
OptimizeRequest:
type: object
required:
- year
- pto_days
properties:
year:
type: integer
enum:
- 2026
- 2027
pto_days:
type: integer
minimum: 1
maximum: 100
description: Scheduled working days to take off.
apply_transfers:
type: boolean
default: false
description: Apply the 2026 workday transfers. Only valid for 2026.
constraints:
type: object
properties:
employment_start_date:
$ref: '#/components/schemas/Date'
extra_days_off:
type: array
maxItems: 100
description: Days that count as days off on top of public holidays, such as days an employer gives. Dates in 2026 or 2027.
items:
$ref: '#/components/schemas/Date'
ErrorResponse:
type: object
required:
- error
properties:
error:
type: object
required:
- code
- message
properties:
code:
type: string
examples:
- VALIDATION_ERROR
message:
type: string
request_id:
type: string
OptimizeResponse:
type: object
required:
- opportunities
- transfers_applied
- statistics
properties:
opportunities:
type: array
maxItems: 10
items:
$ref: '#/components/schemas/Opportunity'
transfers_applied:
type: boolean
statistics:
$ref: '#/components/schemas/CalendarStatistics'
Date:
type: string
format: date
examples:
- '2026-06-24'
responses:
MethodNotAllowed:
description: The path exists but not for this method (METHOD_NOT_ALLOWED).
headers:
Allow:
description: The methods the path accepts.
schema:
type: string
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
InvalidAPIKey:
description: An API key was sent but is not known (INVALID_API_KEY).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
BadRequest:
description: Invalid parameters (VALIDATION_ERROR) or body (INVALID_JSON).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
RequestTooLarge:
description: The request body is over 64 KiB (REQUEST_TOO_LARGE).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
TooManyRequests:
description: The client's rate limit is used up (RATE_LIMIT_EXCEEDED).
headers:
Retry-After:
description: Seconds until the next request is allowed.
schema:
type: integer
minimum: 1
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
securitySchemes:
apiKey:
type: http
scheme: bearer
description: Optional. Raises the rate limit; a supplied but unknown key returns 401.
externalDocs:
description: API documentation
url: https://panembrivdienu.lv/api-docs