# Arizona Court of Appeals, Division Two: Machine-Accessible Court Data > Read-only JSON API for public case information and published decision documents from the Arizona Court of Appeals, Division Two. No authentication required. All endpoints are HTTP GET. Base URL: `https://www.appeals2.az.gov/api` All responses are JSON (`Content-Type: application/json`) except the bulk export, which is NDJSON. Dates are ISO 8601 strings (for example `2025-03-14T00:00:00+00:00`). ## Two ways to call every endpoint Every endpoint accepts its inputs as query-string parameters OR as URL path segments. The two forms are equivalent. If the same value is supplied both ways, the query string wins. - Query-string form: `/api/cases?party=Johnson&county=Pima` - Path form: `/api/cases/party/Johnson/county/Pima` Rules for path-style URLs: - Path segments are URL-decoded. Encode spaces as `%20` (a literal `+` is NOT treated as a space in a path). Example: `/api/case/number/2%20CA-CR%202025-0002` - Filters on `/api/cases` are `key/value` pairs. An odd number of segments returns 400 (`Invalid path`). - Keys are case-insensitive but must be one of the allowed keys for that endpoint. An unknown key returns 400 (`Unknown path filter`) and the response lists the allowed keys. - If a value might contain a `/` or `?`, percent-encode it, or use the query-string form instead. - Trailing slashes are ignored (`/api/cases/` is the same as `/api/cases`). ## Important: IDs and case numbers Every case has an internal numeric `case_id` and a formatted `case_number` (such as `2 CA-CR 2025-0002`). - `/api/case` accepts either `case_id` or `case_number`. - `/api/case/{case_id}/documents` takes only the numeric `case_id`. Get it from the `case_id` field of any Case object. - `case_number` must be the formatted form exactly as the court writes it (for example `2 CA-CR 2025-0002`). Extra whitespace is ignored. Other formats, such as the raw database number, are not supported. - A bare number in the path (`/api/case/12345`) is always treated as a `case_id`. A case number must use the `/number/` prefix. --- ## Endpoints ### 1. Get one case Accepted forms (all return the same Case object): | By | Query-string form | Path form | |----|-------------------|-----------| | case_id | `/api/case?case_id=12345` | `/api/case/12345` or `/api/case/id/12345` | | case_number | `/api/case?case_number=2%20CA-CR%202025-0002` | `/api/case/number/2%20CA-CR%202025-0002` | Examples: ``` https://www.appeals2.az.gov/api/case/12345 https://www.appeals2.az.gov/api/case/id/12345 https://www.appeals2.az.gov/api/case/number/2%20CA-CR%202025-0002 https://www.appeals2.az.gov/api/case?case_number=2%20CA-CR%202025-0002 https://www.appeals2.az.gov/api/case?case_id=12345 ``` Returns a single Case object (see "Case object" below). If both `case_id` and `case_number` are given, `case_id` wins. Leading zeros and non-digit characters in `case_id` are ignored. Errors: - 400 if neither `case_id` nor `case_number` is given, or `case_id` has no digits - 404 if no case matches - 404 (`Not found`) if the path shape is not one of the forms above, for example `/api/case/2%20CA-CR%202025-0002` (missing `/number/`) or `/api/case/abc` ### 2. Search cases (paginated) Query-string form: `GET /api/cases?party=Johnson&county=Pima` Path form: `GET /api/cases/party/Johnson/county/Pima` All filters are optional and combine with AND. The same names work as query parameters or as path keys: | Parameter / path key | Behavior | |----------------------|----------| | `case_number` | Exact formatted case number, e.g. `2 CA-CR 2025-0002` | | `party` | Substring match against the case title (party names) | | `from_date` | Filing date on or after this date (YYYY-MM-DD) | | `to_date` | Filing date on or before this date (YYYY-MM-DD) | | `county` | Exact county name, e.g. `Maricopa` | | `case_type` | Case type code, e.g. `CR`, `CV`, `PT` | | `status` | Exact current status, e.g. `Active`, `Closed`, `Mandate` | | `page` | Page number, default 1 | | `per_page` | Results per page, default 50, maximum 100 | | `format` | Set to `ndjson` for bulk export (see next section) | Examples (these two are equivalent): ``` https://www.appeals2.az.gov/api/cases?county=Maricopa&case_type=CR&from_date=2025-01-01&to_date=2025-12-31&per_page=100 https://www.appeals2.az.gov/api/cases/county/Maricopa/case_type/CR/from_date/2025-01-01/to_date/2025-12-31/per_page/100 ``` Mixing is allowed; query-string values override path values: ``` https://www.appeals2.az.gov/api/cases/county/Pima?party=Johnson ``` Response shape: ```json { "cases": [ { "...Case object..." } ], "pagination": { "page": 1, "per_page": 50, "total": 240, "total_pages": 5, "has_more": true }, "export": "Add format=ndjson (or /format/ndjson in the path) to stream all matching cases." } ``` To read all results, increase `page` until `has_more` is false, or use the bulk export below. ### 3. Bulk export (NDJSON) Query-string form: `GET /api/cases?format=ndjson` Path form: `GET /api/cases/format/ndjson` Accepts the same filters as the search above (`page` and `per_page` are ignored). Streams every matching case as newline-delimited JSON, one Case object per line, ordered by `case_id`. Use this instead of paging when you need all results. Content-Type is `application/x-ndjson`. Examples (equivalent): ``` https://www.appeals2.az.gov/api/cases?format=ndjson&county=Pima&from_date=2025-01-01 https://www.appeals2.az.gov/api/cases/format/ndjson/county/Pima/from_date/2025-01-01 ``` Prefer narrowing with filters over exporting the entire database. ### 4. Recent decisions Accepted forms: | Form | Example | |------|---------| | Query string | `/api/decisions/recent?since=2025-10-01` | | Path (short) | `/api/decisions/recent/2025-10-01` | | Path (explicit) | `/api/decisions/recent/since/2025-10-01` | | No date | `/api/decisions/recent` | `since` is YYYY-MM-DD and defaults to 30 days ago. It matches cases where either the primary or secondary decision was published on or after that date. If both a query-string `since` and a path date are given, the query string wins. Example: ``` https://www.appeals2.az.gov/api/decisions/recent/2025-10-01 ``` Response shape: ```json { "decisions": [ { "...Case object..." } ], "total": 12, "since": "2025-10-01" } ``` Notes: - Returns at most 100 cases, ordered by most recent decision publication date (primary or secondary), newest first. - Only includes cases that have a published decision document and whose status is not `Mandate` or `Closed`. Decisions flagged as hidden are excluded. - A malformed `since` returns 400. Extra path segments after the date return 404. ### 5. Decisions list `GET /api/decisions` Same as `/api/decisions/recent` with no date filter. Same 100-case limit and same inclusion rules (published decision, status not Mandate or Closed, not hidden). Response is `{ "decisions": [...], "total": N }`. This is NOT a list of all decisions ever issued. For closed cases or complete history, use `/api/cases` or the NDJSON export. ### 6. Documents for a case `GET /api/case/{case_id}/documents` This endpoint is path-only and requires the numeric `case_id` (not a case number). Example: ``` https://www.appeals2.az.gov/api/case/12345/documents ``` Response shape: ```json { "case_id": 12345, "case_number": "2 CA-CR 2025-0002", "documents": [ { "type": "decision", "filename": "example.pdf", "url": "https://www.appeals2.az.gov/serveFile.php?type=DE&file=example.pdf", "published_date": "2025-03-14T00:00:00+00:00", "decision_type": "Memorandum Decision" } ], "total": 1 } ``` Currently this lists only published decision documents (up to two per case: primary and secondary). It does not list briefs, motions, or other docket filings. Use `docket_link` from the Case object to view the full docket on the court website. Returns 404 if the `case_id` does not exist. --- ## Case object | Field | Type | Description | |-------|------|-------------| | `case_id` | number or string | Internal ID. Use this for `/api/case` and `/api/case/{case_id}/documents` | | `case_number` | string | Formatted case number, e.g. `2 CA-CR 2025-0002` | | `case_title` | string | Party names / caption, e.g. `JOHNSON v. STATE` | | `county` | string | County where the case originated | | `filing_date` | string (ISO 8601) or null | Filing date | | `docket_link` | string (URL) | Public docket page on the court website | | `decision_type` | string or null | e.g. `Opinion`, `Memorandum Decision` | | `published_date` | string (ISO 8601) or null | Publication date of the primary decision | | `decision_document` | string (URL) or null | Direct link to the primary decision document | | `decision2_type` | string or null | Secondary decision type, if any | | `decision2_document` | string (URL) or null | Secondary decision document link | | `decision2_published_date` | string (ISO 8601) or null | Secondary decision publication date | | `current_status` | string | `Active`, `Closed`, `Mandate`, etc. | | `sealed` | boolean | `true` if the case is flagged as sealed. This is informational metadata only; it does not change what the API returns for the case | | `issues_summary` | string or null | Summary of the legal issues | | `is_constitutional` | boolean | `true` if the case raises constitutional issues | | `trial_court_case_numbers` | array of strings or null | Trial court case number(s); null if none | A case with no published decision has `decision_type`, `published_date`, and `decision_document` set to null. --- ## Errors Errors return a JSON body with an `error` message and, usually, a `details` object. | Status | When | Example body | |--------|------|--------------| | 400 | Missing or invalid parameter | `{"error": "Missing required parameter", "details": {"parameter": "case_id or case_number"}}` | | 400 | Path filters not in key/value pairs | `{"error": "Invalid path", "details": {"message": "Path filters must be key/value pairs, e.g. /api/cases/party/Johnson", "received": "party"}}` | | 400 | Unknown path filter key | `{"error": "Unknown path filter", "details": {"filter": "foo", "allowed": ["case_number", "party", "..."]}}` | | 400 | Malformed `since` date | `{"error": "Invalid date", "details": {"parameter": "since", "expected": "YYYY-MM-DD"}}` | | 404 | Case not found | `{"error": "Case not found", "details": {"case_number": "2 CA-CR 2025-0002"}}` (or `{"case_id": "12345"}` when looked up by ID) | | 404 | Unknown endpoint or unsupported path shape | `{"error": "Not found", "details": {"path": "/api/foo", "message": "The requested API endpoint does not exist"}}` | | 405 | Non-GET request | `{"error": "Method not allowed", "details": {"allowed": "GET"}}` | --- ## Usage notes - Data is public court record. No API key or login is needed. - When building URLs programmatically, percent-encode every path segment (spaces as `%20`). ## Suggested workflows - "What was the decision in case 2 CA-CR 2025-0002?" → `/api/case/number/2%20CA-CR%202025-0002`, then read `decision_type`, `published_date`, and `decision_document` from the result. - "Find the opinion for Johnson v. State" → `/api/cases/party/Johnson` (or `/api/cases?party=Johnson`), then match on `case_title`. - "What was decided recently?" → `/api/decisions/recent/YYYY-MM-DD` (or `/api/decisions/recent?since=YYYY-MM-DD`). - "What documents exist for this case?" → take `case_id` from any Case object, then `/api/case/{case_id}/documents`. - "Give me every Pima County case filed this year" → `/api/cases/format/ndjson/county/Pima/from_date/2025-01-01`.