ExDocApi/ Docs

Schemas

Schemas let you save a named set of extraction fields and reuse them across jobs. Instead of repeating the same fields object in every request, create a schema once and reference it by ID.

All schema endpoints require authentication.


Schema object

{
  "id":          "sch_uuid_here",
  "name":        "HRM Offer Letter",
  "description": "Fields to extract from employee offer letters",
  "fields": [
    { "key": "employee_name", "label": "Employee Name", "description": "Full legal name",  "required": true  },
    { "key": "designation",   "label": "Designation",   "description": "Job title",        "required": true  },
    { "key": "joining_date",  "label": "Joining Date",  "description": "Start date",       "required": true  },
    { "key": "salary",        "label": "Salary",        "description": "CTC offered",      "required": false }
  ],
  "is_active":   true,
  "created_at":  "2024-11-01T09:00:00Z",
  "updated_at":  "2024-11-01T09:00:00Z"
}

Field object

| Property | Type | Required | Description | |----------|------|----------|-------------| | key | string | Yes | Field name in the result JSON. Letters, digits, underscores. Max 64 chars. | | label | string | Yes | Human-readable label. Max 100 chars. | | description | string | No | What to look for in the document. Max 300 chars. | | required | boolean | Yes | Hint — whether this field is typically present in this document type. |


Limits

| Limit | Value | |-------|-------| | Schemas per account | 50 | | Fields per schema | 50 | | Schema name length | 100 chars |


GET /api/v1/schemas

List all active schemas for your account.

curl "https://exdocapi.cheapehai.shop/api/v1/schemas" \
  -H "Authorization: Bearer $EXDOC_API_KEY"

Response — 200 OK:

{
  "schemas": [
    {
      "id": "sch_uuid_here",
      "name": "HRM Offer Letter",
      "description": "Fields for offer letters",
      "fields": [...],
      "is_active": true,
      "created_at": "2024-11-01T09:00:00Z",
      "updated_at": "2024-11-01T09:00:00Z"
    }
  ]
}

POST /api/v1/schemas

Create a new schema.

curl -X POST "https://exdocapi.cheapehai.shop/api/v1/schemas" \
  -H "Authorization: Bearer $EXDOC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "HRM Offer Letter",
    "description": "Fields to extract from employee offer letters",
    "fields": [
      { "key": "employee_name", "label": "Employee Name", "description": "Full legal name",  "required": true  },
      { "key": "designation",   "label": "Designation",   "description": "Job title",        "required": true  },
      { "key": "joining_date",  "label": "Joining Date",  "description": "Start date",       "required": true  },
      { "key": "salary",        "label": "Salary",        "description": "CTC offered",      "required": false }
    ]
  }'

Response — 201 Created:

{
  "schema": {
    "id": "sch_uuid_here",
    "name": "HRM Offer Letter",
    ...
  }
}

GET /api/v1/schemas/:id

Fetch a single schema by ID.

curl "https://exdocapi.cheapehai.shop/api/v1/schemas/sch_uuid_here" \
  -H "Authorization: Bearer $EXDOC_API_KEY"

Response — 200 OK:

{ "schema": { ... } }

PATCH /api/v1/schemas/:id

Update a schema. Send only the fields you want to change.

curl -X PATCH "https://exdocapi.cheapehai.shop/api/v1/schemas/sch_uuid_here" \
  -H "Authorization: Bearer $EXDOC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Updated Name", "description": "New description" }'

| Body field | Type | Description | |------------|------|-------------| | name | string | New name (optional) | | description | string | New description (optional) | | fields | array | Replace all fields (optional) |

Response — 200 OK: Updated schema object.


DELETE /api/v1/schemas/:id

Soft-delete a schema (sets is_active = false). Existing jobs that used this schema are unaffected — the fields are stored on the job itself.

curl -X DELETE "https://exdocapi.cheapehai.shop/api/v1/schemas/sch_uuid_here" \
  -H "Authorization: Bearer $EXDOC_API_KEY"

Response — 200 OK:

{ "ok": true }

Error responses

| Status | Meaning | |--------|---------| | 400 | Missing name, invalid fields, field key too long | | 401 | Invalid API key | | 404 | Schema not found or belongs to a different account | | 429 | Schema limit (50) reached |

← PreviousGET /usageNext →Document types API