API Reference

Credential Types

List Credential Types

  • API Name: List Credential Types
  • API Route: GET /api/v1/credential-types
  • Request:
    • Query Params: search (string, optional), page (number, default: 1), pageSize (number, default: 20)
    • Auth: Session required
  • What it does: Returns a paginated list of credential type definitions available to the authenticated user. Can be filtered by name using the search parameter.
  • Returns: Paginated result { data: [...], total, page, pageSize }

Create Credential Type

  • API Name: Create Credential Type
  • API Route: POST /api/v1/credential-types
  • Request:
    • Body:
json
    {
      "typeName": "string (required)",
      "description": "string (optional)",
      "fields": [
        {
          "fieldName": "string (required)",
          "fieldLabel": "string (required)",
          "fieldType": "string (required)"
        }
      ]
    }
  • What it does: Creates a new credential type schema definition with one or more field definitions. Each field specifies what key-value pairs the credentials of this type will have.
  • Returns: 201 with the created credential type object. 400 if typeName or fields are missing, or if any field is missing required properties.

Get Credential Type

  • API Name: Get Credential Type by ID
  • API Route: GET /api/v1/credential-types/[id]
  • Request:
    • Params: id (string) — Credential Type ID
    • Auth: Session required
  • What it does: Fetches a single credential type definition including its field schema.
  • Returns: The credential type object with fields. 404 if not found.

Update Credential Type

  • API Name: Update Credential Type
  • API Route: PUT /api/v1/credential-types/[id]
  • Request:
    • Params: id (string) — Credential Type ID
    • Body: Any updatable fields (typeName, description, fields)
    • Auth: Session required
  • What it does: Updates an existing credential type's name, description, or field definitions.
  • Returns: The updated credential type object.

Delete Credential Type

  • API Name: Delete Credential Type
  • API Route: DELETE /api/v1/credential-types/[id]
  • Request:
    • Params: id (string) — Credential Type ID
    • Auth: Session required
  • What it does: Permanently deletes a credential type definition. Will fail if there are existing credentials using this type.
  • Returns: { "success": true }

Check Credential Type Usage

  • API Name: Check Credential Type Usage
  • API Route: GET /api/v1/credential-types/[id]/usage
  • Request:
    • Params: id (string) — Credential Type ID
    • Auth: Session required
  • What it does: Returns information about how many credentials are currently using this credential type, useful to check before attempting deletion.
  • Returns: { "count": number, "inUse": boolean }