API v1support@grafena.pl← Wróć do aplikacji

grafena. API

Programmatic access to your employees and schedules. Available on the Full plan.

Base URL

https://grafena.pl/api/v1

Response format

All responses are JSON. Successful responses wrap the result in a data field. Errors return an error string.

API keys are managed in Settings → API Keys inside the app. You need a Full plan to generate keys and use the API.

Authentication

Pass your API key as a Bearer token in the Authorization header on every request.

Authorization: Bearer grafena_your_key_here
API keys are shown once at creation and cannot be recovered. Store them securely. If lost, delete the key and generate a new one.

Errors

StatusMeaning
400Bad request — missing or invalid parameters
401Missing or invalid API key
403Plan limit reached or feature not available on your plan
404Resource not found (or belongs to another account)
429Rate limit exceeded
500Internal server error

Error response shape

{ "error": "Employee not found" }

Rate Limits

60 requests per minute per API key. The response includes standard RateLimit-* headers so you can track your usage.

Employees

GET
/api/v1/employees
List all employees
POST
/api/v1/employees
Create an employee
PUT
/api/v1/employees/:id
Update an employee
DELETE
/api/v1/employees/:id
Delete an employee

Employee object

FieldTypeDescription
idstringUnique identifier
namestringFull name
maxHoursnumberMonthly contracted hours
shiftTypestringday | night | both | short | custom ID
shortHoursstringFor short shifts: 2h | 5h | 8h
unavailableobjectMap of "YYYY-M": [day, ...]
contractstringuop (employment contract) | zlecenie (civil contract; labour-code checks are skipped)
createdAtstringISO 8601 timestamp

POST /api/v1/employees — request body

{
  "name":      "Anna Kowalska",      // required
  "maxHours":  160,                  // optional, default 160
  "shiftType": "day",                // optional, default "day"
  "shortHours": "5h",                // optional, default "5h"
  "contract":  "uop"                 // optional, default "uop"; left unchanged by PUT when omitted
}

Example response — GET /api/v1/employees

{
  "data": [
    {
      "id": "clxyz123",
      "name": "Anna Kowalska",
      "maxHours": 160,
      "shiftType": "day",
      "shortHours": "5h",
      "unavailable": {},
      "contract": "uop",
      "createdAt": "2026-01-15T10:00:00.000Z"
    }
  ]
}

Schedules

GET
/api/v1/schedules
List published schedules (metadata only). Schedules that were never published are left out.
GET
/api/v1/schedules/:id
Get the published version of a schedule with its full grid; 404 when it was never published. Unpublished edits are not included.
DELETE
/api/v1/schedules/:id
Delete a schedule

Schedule object (list)

FieldTypeDescription
idstringUnique identifier
namestringSchedule name
yearnumberYear
monthnumberMonth (1–12)
employeeCountnumberNumber of employees in this schedule
createdAtstringISO 8601 timestamp

Grid format — GET /api/v1/schedules/:id

The grid is a map of day → employeeId → cell. Each cell describes the shift assigned to that employee on that day.

{
  "data": {
    "id": "clxyz456",
    "name": "Marzec 2026",
    "year": 2026,
    "month": 3,
    "employeeCount": 12,
    "grid": {
      "1": {
        "clxyz123": { "type": "day", "hours": 12, "label": "07:00–19:00", "start": "07:00" }
      },
      "2": {
        "clxyz123": { "type": "off", "hours": 0, "label": "" }
      }
    },
    "employees": [ ... ],
    "createdAt": "2026-03-01T08:00:00.000Z"
  }
}

Cell types

typeMeaning
dayDay shift
nightNight shift
bothDay or night shift
shortShort shift
offDay off
restLegacy: a day off in schedules saved before October 2026. Treat it as off.
unavailEmployee unavailable (marked in advance)
custom_*Custom shift type defined in settings