Skip to main content
POST
/
api
/
selected-skills
Add Selected Skill
curl --request POST \
  --url https://api.example.com/v1/api/selected-skills \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "user_id": "<string>",
  "skill_id": "<string>",
  "sub_skill_id": "<string>",
  "master_skill_id": "<string>"
}
'
{
  "success": true,
  "message": "Skill selected successfully",
  "data": {
    "selected_skill_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "user_id": "user-123",
    "skill_id": "sk-001",
    "sub_skill_id": "sub-001",
    "master_skill_id": "ms-001",
    "createdAt": "2025-01-15T10:30:00.000Z",
    "updatedAt": "2025-01-15T10:30:00.000Z"
  }
}
Send a user ID and a skill ID, and this creates a record tying them together. That’s it. One rule: a user can’t select the same skill twice. Try it and you’ll get a 409. This is enforced at both the application level and in the database with a compound unique index, so even concurrent requests won’t create duplicates. No authentication needed.

Request Body

user_id
string
required
The user who’s selecting the skill.
skill_id
string
required
The skill being selected.
sub_skill_id
string
required
The sub-skill category this skill belongs to. You can get this from the search endpoint.
master_skill_id
string
required
The master skill category. Also available from search results.

Response

success
boolean
true when the record is created
message
string
A short confirmation message
data
object
The newly created record. Hold onto the selected_skill_id — you’ll need it if you want to delete this later.

Examples

curl -X POST http://localhost:5000/api/selected-skills \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "user-123",
    "skill_id": "sk-001",
    "sub_skill_id": "sub-001",
    "master_skill_id": "ms-001"
  }'
{
  "success": true,
  "message": "Skill selected successfully",
  "data": {
    "selected_skill_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "user_id": "user-123",
    "skill_id": "sk-001",
    "sub_skill_id": "sub-001",
    "master_skill_id": "ms-001",
    "createdAt": "2025-01-15T10:30:00.000Z",
    "updatedAt": "2025-01-15T10:30:00.000Z"
  }
}

Why does the 409 check happen twice?The route checks for an existing { user_id, skill_id } record before trying to insert. But just in case two requests land at exactly the same time, the database also has a compound unique index on those fields. The app-level check gives you the nicer error message. The DB-level index is the safety net.