Auth

Sign-in, badges and second-factor challenges.

7 endpoints · Plakar Control Plane v0.18 · Base URL, authentication and errors

Issue a new badge

POST /api/v1/auth/badge
Badge
Re-issues the caller’s badge, for instance scoped to another organization.

Request body application/json required

  • organization_id string<uuid>
  • role string nullable

Response 200 OK application/json

  • token string

Errors

  • 400 Bad Request (validation or deserialization error)
  • 401 Missing, invalid or expired credentials
  • 403 The caller may not do this
  • 500 Internal Server Error (panics)

Every error returns the standard error body.

Request

curl -X POST 'https://pcp.example.com/api/v1/auth/badge' \
  -H 'Authorization: Bearer <badge>' \
  -H 'Content-Type: application/json' \
  -d '{
  "organization_id": "3f1e4a2c-9b7d-4e0f-8a11-2c5d6e7f8a90",
  "role": "string"
}'

Response 200

{
  "token": "string"
}

Complete a login with a second factor

POST /api/v1/auth/login/2fa
No authentication

Request body application/json required

  • challenge_id string required
  • code string required

Response 200 OK application/json

  • token string

Errors

  • 400 Bad Request (validation or deserialization error)
  • 500 Internal Server Error (panics)

Every error returns the standard error body.

Request

curl -X POST 'https://pcp.example.com/api/v1/auth/login/2fa' \
  -H 'Content-Type: application/json' \
  -d '{
  "challenge_id": "string",
  "code": "string"
}'

Response 200

{
  "token": "string"
}

Log in with an API key

POST /api/v1/auth/login/apikey
No authentication

Request body application/json required

  • api_key string required

Response 200 OK application/json

  • token string

Errors

  • 400 Bad Request (validation or deserialization error)
  • 500 Internal Server Error (panics)

Every error returns the standard error body.

Request

curl -X POST 'https://pcp.example.com/api/v1/auth/login/apikey' \
  -H 'Content-Type: application/json' \
  -d '{
  "api_key": "string"
}'

Response 200

{
  "token": "string"
}

Start the TOTP enrollment a login requires

POST /api/v1/auth/login/enroll/totp
No authentication

Request body application/json required

  • enrollment_challenge_id string required

Response 200 OK application/json

  • otpauth_uri string
  • secret string

Errors

  • 400 Bad Request (validation or deserialization error)
  • 500 Internal Server Error (panics)

Every error returns the standard error body.

Request

curl -X POST 'https://pcp.example.com/api/v1/auth/login/enroll/totp' \
  -H 'Content-Type: application/json' \
  -d '{
  "enrollment_challenge_id": "string"
}'

Response 200

{
  "otpauth_uri": "string",
  "secret": "string"
}

Confirm the TOTP enrollment a login requires

POST /api/v1/auth/login/enroll/totp/confirm
No authentication

Request body application/json required

  • code string required
  • enrollment_challenge_id string required

Response 200 OK application/json

  • recovery_codes array[string]
  • token string

Errors

  • 400 Bad Request (validation or deserialization error)
  • 500 Internal Server Error (panics)

Every error returns the standard error body.

Request

curl -X POST 'https://pcp.example.com/api/v1/auth/login/enroll/totp/confirm' \
  -H 'Content-Type: application/json' \
  -d '{
  "code": "string",
  "enrollment_challenge_id": "string"
}'

Response 200

{
  "recovery_codes": [
    "string"
  ],
  "token": "string"
}

Log in with email and password

POST /api/v1/auth/login/password
No authentication

Request body application/json required

  • account string required
  • password string required

Response 200 OK application/json

  • challenge_id string nullable
  • enrollment_challenge_id string nullable
  • token string nullable

Errors

  • 400 Bad Request (validation or deserialization error)
  • 500 Internal Server Error (panics)

Every error returns the standard error body.

Request

curl -X POST 'https://pcp.example.com/api/v1/auth/login/password' \
  -H 'Content-Type: application/json' \
  -d '{
  "account": "string",
  "password": "string"
}'

Response 200

{
  "challenge_id": "string",
  "enrollment_challenge_id": "string",
  "token": "string"
}

Poll a pending login

POST /api/v1/auth/poll/{token}
No authentication

Path parameters

  • token string required

Response 200 OK application/json

  • token string

Response 202 The login is still pending

No response body.

Errors

  • 400 Bad Request (validation or deserialization error)
  • 500 Internal Server Error (panics)

Every error returns the standard error body.

Request

curl -X POST 'https://pcp.example.com/api/v1/auth/poll/{token}'

Response 200

{
  "token": "string"
}