Skip to main content
POST
/
api
/
v1
/
classify
# Base64-encode the PDF, then send it
PDF_B64=$(base64 -i motion_for_sj.pdf)

curl -X POST https://api.courtrules.app/api/v1/classify \
 -H "Authorization: Bearer YOUR_API_KEY" \
 -H "Content-Type: application/json" \
 -d "{
\"judge_slug\": \"carol-bagley-amon\",
\"district_id\": \"edny\",
\"pdf_base64\": \"$PDF_B64\",
\"filename\": \"memo_in_support_sj.pdf\"
}"

{
  "classification": {
    "document_scope": "brief_support",
    "motion_type": "Rule_56",
    "confidence": "high",
    "supported": true,
    "reasoning": "Document is titled 'Memorandum of Law in Support of Motion for Summary Judgment', contains Rule 56 references, and includes a statement of undisputed material facts."
  },
  "document": {
    "page_count": 31,
    "word_count": 10000,
    "caption": {
      "present": true,
      "has_court_name": true,
      "has_case_title": true,
      "has_docket_number": true,
      "has_document_designation": true
    },
    "sections": {
      "has_toc": true,
      "has_toa": true,
      "has_certificate_of_compliance": false,
      "has_certificate_of_service": true,
      "has_numbered_paragraphs": false,
      "has_56_1_statement": true,
      "has_56_1_counterstatement": false,
      "has_proposed_amended_pleading": false,
      "has_verbatim_discovery_text": false,
      "has_conferral_certification": false,
      "has_notice_of_motion": true,
      "has_memorandum_of_law": true,
      "has_supporting_affidavits": true,
      "has_pro_se_sj_notice": false
    }
  },
  "check_request": {
    "judge_slug": "carol-bagley-amon",
    "district_id": "edny",
    "document_scope": "brief_support",
    "motion_type": "Rule_56",
    "document": {
      "page_count": 31,
      "word_count": 10000,
      "caption": {
        "present": true,
        "has_court_name": true,
        "has_case_title": true,
        "has_docket_number": true,
        "has_document_designation": true
      },
      "sections": {
        "has_toc": true,
        "has_toa": true,
        "has_certificate_of_compliance": false,
        "has_certificate_of_service": true,
        "has_numbered_paragraphs": false,
        "has_56_1_statement": true,
        "has_56_1_counterstatement": false,
        "has_proposed_amended_pleading": false,
        "has_verbatim_discovery_text": false,
        "has_conferral_certification": false,
        "has_notice_of_motion": true,
        "has_memorandum_of_law": true,
        "has_supporting_affidavits": true,
        "has_pro_se_sj_notice": false
      }
    }
  },
  "page_count_analysis": {
    "total_pdf_pages": 35,
    "front_matter_pages": 2,
    "back_matter_pages": 2,
    "body_page_count": 31,
    "method": "llm_structural_analysis"
  },
  "format_detection": {
    "confidence": "high",
    "confidence_reason": "Font and margin data extracted successfully from PDF structure",
    "warning": null,
    "font_family": "TimesNewRoman",
    "font_name_raw": "ABCDEF+TimesNewRomanPSMT",
    "margins_per_side": { "top": 1.0, "bottom": 1.0, "left": 1.0, "right": 1.0 },
    "line_spacing_pt": 24.0
  }
}
POST /api/v1/classify
Upload a PDF and receive document classification (scope, motion type) plus a partial request body for the /check endpoint when the PDF is a supported federal filing. The API extracts page count, word count, structural metadata, and document type from the PDF automatically. You must add filing context fields (is_pro_se, pmc_completed, opposing_party_pro_se, filing_role) before sending to /check. The response includes a supported boolean indicating whether the document is a classifiable federal court filing. Non-federal documents, blank templates, court rules or practices, and non-legal documents return supported: false with confidence: "low" and no check_request. Uploaded PDFs are stored server-side for quality improvement. Note: May take 10-30 seconds to respond. Format extraction (font, margins, line spacing) has a 15-second timeout; fillable forms and interactive PDFs may hit this limit, in which case format checks are skipped and a warning is returned.

Try it

A sample filing PDF is available in the console playground. Upload it to see classification, extracted metadata, and a ready-to-run /check request body.

Request

judge_slug
string
required
Judge slug identifier (e.g. gary-r-brown)
district_id
string
required
District identifier (e.g. edny)
pdf_base64
string
required
Base64-encoded PDF file.
filename
string
Original filename of the PDF (e.g. motion_for_summary_judgment.pdf). Recommended: always include if available. Filenames like memo_in_support_sj.pdf provide a strong classification signal; generic names like document.pdf are still accepted but add no value.
# Base64-encode the PDF, then send it
PDF_B64=$(base64 -i motion_for_sj.pdf)

curl -X POST https://api.courtrules.app/api/v1/classify \
 -H "Authorization: Bearer YOUR_API_KEY" \
 -H "Content-Type: application/json" \
 -d "{
\"judge_slug\": \"carol-bagley-amon\",
\"district_id\": \"edny\",
\"pdf_base64\": \"$PDF_B64\",
\"filename\": \"memo_in_support_sj.pdf\"
}"

{
  "classification": {
    "document_scope": "brief_support",
    "motion_type": "Rule_56",
    "confidence": "high",
    "supported": true,
    "reasoning": "Document is titled 'Memorandum of Law in Support of Motion for Summary Judgment', contains Rule 56 references, and includes a statement of undisputed material facts."
  },
  "document": {
    "page_count": 31,
    "word_count": 10000,
    "caption": {
      "present": true,
      "has_court_name": true,
      "has_case_title": true,
      "has_docket_number": true,
      "has_document_designation": true
    },
    "sections": {
      "has_toc": true,
      "has_toa": true,
      "has_certificate_of_compliance": false,
      "has_certificate_of_service": true,
      "has_numbered_paragraphs": false,
      "has_56_1_statement": true,
      "has_56_1_counterstatement": false,
      "has_proposed_amended_pleading": false,
      "has_verbatim_discovery_text": false,
      "has_conferral_certification": false,
      "has_notice_of_motion": true,
      "has_memorandum_of_law": true,
      "has_supporting_affidavits": true,
      "has_pro_se_sj_notice": false
    }
  },
  "check_request": {
    "judge_slug": "carol-bagley-amon",
    "district_id": "edny",
    "document_scope": "brief_support",
    "motion_type": "Rule_56",
    "document": {
      "page_count": 31,
      "word_count": 10000,
      "caption": {
        "present": true,
        "has_court_name": true,
        "has_case_title": true,
        "has_docket_number": true,
        "has_document_designation": true
      },
      "sections": {
        "has_toc": true,
        "has_toa": true,
        "has_certificate_of_compliance": false,
        "has_certificate_of_service": true,
        "has_numbered_paragraphs": false,
        "has_56_1_statement": true,
        "has_56_1_counterstatement": false,
        "has_proposed_amended_pleading": false,
        "has_verbatim_discovery_text": false,
        "has_conferral_certification": false,
        "has_notice_of_motion": true,
        "has_memorandum_of_law": true,
        "has_supporting_affidavits": true,
        "has_pro_se_sj_notice": false
      }
    }
  },
  "page_count_analysis": {
    "total_pdf_pages": 35,
    "front_matter_pages": 2,
    "back_matter_pages": 2,
    "body_page_count": 31,
    "method": "llm_structural_analysis"
  },
  "format_detection": {
    "confidence": "high",
    "confidence_reason": "Font and margin data extracted successfully from PDF structure",
    "warning": null,
    "font_family": "TimesNewRoman",
    "font_name_raw": "ABCDEF+TimesNewRomanPSMT",
    "margins_per_side": { "top": 1.0, "bottom": 1.0, "left": 1.0, "right": 1.0 },
    "line_spacing_pt": 24.0
  }
}

Response fields

classification
object
Document type classification
document
object
Extracted document metadata including page count, word count, and structural elements detected in the PDF (caption, sections, format, privacy).
check_request
object
Present only when supported is true. A partial request body for POST /api/v1/check. Includes judge_slug, district_id, document_scope, motion_type (if detected), and the full document object. You must add is_pro_se, pmc_completed, opposing_party_pro_se, and filing_role before sending.
page_count_analysis
object
Breakdown of how body page count was computed from total PDF pages.
format_detection
object
Detected font, margin, and line spacing from the PDF. Used for formatting compliance checks.
warnings
string[]
Conditions that may affect result quality. Present only when something noteworthy occurred during analysis (e.g., format extraction failed, document was truncated).

Error responses

CodeMeaning
400Invalid request (missing pdf_base64, invalid judge_slug, etc.)
403District not accessible
404Judge not found in the specified district
429Rate limit exceeded (5 requests per minute)
502Classification failed (timeout, upstream error)

Usage pattern

The typical supported-document flow is classify, then check:
POST /classify  →  get check_request  →  POST /check
When present, the check_request field contains everything the classifier can extract from the PDF. Before sending it to /check, add the filing context fields that only the filer knows: is_pro_se, pmc_completed, opposing_party_pro_se, and filing_role. When supported is false, show the classification reasoning to the user and do not call /check.