Skip to main content

Your First API Call

Test the Fill solver with a single command:
curl https://api.solvice.io/v2/fill/demo -H "Authorization: YOUR_API_KEY" | \
curl https://api.solvice.io/v2/fill/solve -H "Authorization: YOUR_API_KEY" \
     -X POST -H "Content-Type: application/json" -d @-
This fetches a demo problem and solves it immediately. Replace YOUR_API_KEY with your actual API key from the dashboard.

Basic Fill Request

A Fill request requires two things: employees (your workforce) and shifts (time slots to fill).
{
  "employees": [
    {
      "name": "Alice",
      "skills": [{ "name": "kitchen" }]
    },
    {
      "name": "Bob",
      "skills": [{ "name": "bar" }]
    }
  ],
  "shifts": [
    {
      "name": "morning-kitchen",
      "from": "2024-04-18T08:00:00",
      "to": "2024-04-18T14:00:00",
      "skills": [{ "name": "kitchen" }],
      "min": 1,
      "max": 1
    },
    {
      "name": "evening-bar",
      "from": "2024-04-18T18:00:00",
      "to": "2024-04-18T23:00:00",
      "skills": [{ "name": "bar" }],
      "min": 1,
      "max": 1
    }
  ]
}

Understanding the Response

The solver returns optimized shift assignments:
Solution
{
  "score": {
    "hardScore": 0,
    "mediumScore": 0,
    "softScore": -2,
    "feasible": true
  },
  "assignments": [
    {
      "shift": "morning-kitchen",
      "from": "2024-04-18T08:00:00",
      "to": "2024-04-18T14:00:00",
      "skills": ["kitchen"],
      "employee": "Alice"
    },
    {
      "shift": "evening-bar",
      "from": "2024-04-18T18:00:00",
      "to": "2024-04-18T23:00:00",
      "skills": ["bar"],
      "employee": "Bob"
    }
  ]
}
feasible
boolean
true if all hard constraints are satisfied (skills match, no conflicts)
assignments
array
List of shift-employee pairings with timing details

Key Concepts

ConceptDescription
EmployeeA worker with skills who can be assigned to shifts
ShiftA time slot requiring specific skills and number of workers
SkillsCapabilities that match employees to appropriate shifts
ScoreSolution quality indicator (hard/medium/soft constraints)

Next Steps