> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usecroma.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Estado de un trabajo

> Poll the state and result of an export job. Returns the job envelope; `data` is populated once `status` is `completed`, `error` once it is `failed`. Jobs are scoped to your organization: another organization's job reads as 404. Polling draws from its own, more generous rate-limit bucket.



## OpenAPI

````yaml legal/openapi.json GET /jobs/{id}
openapi: 3.1.0
info:
  title: Croma Legal API
  version: 1.0.0
  description: >-
    Read-only access to your organization's litigation portfolio in Croma Legal:
    cases (processes), actuaciones, defendants, portfolio analytics and bulk
    exports. Every request is scoped to the organization that owns the API key.
servers:
  - url: https://api.legal.usecroma.com
security:
  - bearerAuth: []
tags:
  - name: Processes
    description: Cases in your portfolio.
  - name: Actuaciones
    description: Court filings and events across every case.
  - name: Defendants
    description: Demandados and the cases linked to them.
  - name: Analytics
    description: Aggregates over the portfolio.
  - name: Exports
    description: Bulk CSV / JSONL files.
  - name: Jobs
    description: Async job status.
paths:
  /jobs/{id}:
    get:
      tags:
        - Jobs
      summary: Get job status
      description: >-
        Poll the state and result of an export job. Returns the job envelope;
        `data` is populated once `status` is `completed`, `error` once it is
        `failed`. Jobs are scoped to your organization: another organization's
        job reads as 404. Polling draws from its own, more generous rate-limit
        bucket.
      operationId: get_job
      parameters:
        - name: id
          in: path
          required: true
          description: >-
            Job id returned as `job.id` / `X-Job-Id` when the export was
            created.
          schema:
            type: string
          example: run_abc123def456
      responses:
        '200':
          description: Job envelope (pending, completed, or failed).
          headers:
            X-Request-Id:
              description: >-
                Unique id for the request (req_…). Include it in support
                reports.
              schema:
                type: string
            X-RateLimit-Limit:
              description: Requests allowed in the current window.
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: Requests left before you are throttled.
              schema:
                type: integer
            X-RateLimit-Reset:
              description: ISO 8601 timestamp when the window resets.
              schema:
                type: string
                format: date-time
            Retry-After:
              description: >-
                Present while the job is still running: seconds to wait before
                polling again.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobEnvelope'
              example:
                job:
                  id: run_abc123def456
                  status: completed
                  endpoint: /v1/exports
                  created_at: '2026-08-21T14:03:10.000Z'
                  finished_at: '2026-08-21T14:03:41.000Z'
                  status_url: https://api.legal.usecroma.com/jobs/run_abc123def456
                data:
                  url: >-
                    https://files.usecroma.com/legal-exports/processes-2026-08-21.csv
                  entity: processes
                  format: csv
                  rows: 1280
                  bytes: 418233
                  truncated: false
                  expires_at: '2026-08-22T14:03:10.000Z'
                error: null
        '401':
          description: Missing or invalid API key
          headers:
            X-Request-Id:
              description: >-
                Unique id for the request (req_…). Include it in support
                reports.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                error:
                  type: authentication_error
                  code: invalid_api_key
                  message: Invalid or missing API key.
        '404':
          description: No job with that id in your organization
          headers:
            X-Request-Id:
              description: >-
                Unique id for the request (req_…). Include it in support
                reports.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                error:
                  type: not_found_error
                  code: job_not_found
                  message: Job not found.
        '429':
          description: Rate limit exceeded
          headers:
            X-Request-Id:
              description: >-
                Unique id for the request (req_…). Include it in support
                reports.
              schema:
                type: string
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                error:
                  type: rate_limit_error
                  code: rate_limited
                  message: Rate limit exceeded. Try again in 42 seconds.
        '500':
          description: Unexpected internal error
          headers:
            X-Request-Id:
              description: >-
                Unique id for the request (req_…). Include it in support
                reports.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                error:
                  type: api_error
                  code: internal_error
                  message: >-
                    Internal error. Contact support with the X-Request-Id if it
                    persists.
      security:
        - bearerAuth: []
      externalDocs:
        description: Guide and examples
        url: https://docs.usecroma.com/legal/exports
components:
  schemas:
    JobEnvelope:
      type: object
      required:
        - job
        - data
        - error
      description: >-
        Returned by `POST /v1/exports` (202) and by `GET /jobs/{id}`. `data`
        holds the export result once `status` is `completed`; `error` is
        populated once `status` is `failed`.
      properties:
        job:
          type: object
          required:
            - id
            - status
            - endpoint
            - created_at
            - finished_at
            - status_url
          properties:
            id:
              type: string
            status:
              type: string
              enum:
                - queued
                - running
                - completed
                - failed
                - canceled
                - expired
            endpoint:
              type: string
              description: The endpoint path that created this job.
            created_at:
              type:
                - string
                - 'null'
              format: date-time
            finished_at:
              type:
                - string
                - 'null'
              format: date-time
            status_url:
              type: string
              format: uri
              description: GET this URL to poll the job.
        data:
          description: The export result once completed; null until then.
          oneOf:
            - $ref: '#/components/schemas/ExportResult'
            - type: 'null'
        error:
          description: Populated once the job has failed; null otherwise.
          oneOf:
            - type: object
              required:
                - type
                - code
                - message
              properties:
                type:
                  type: string
                code:
                  type: string
                message:
                  type: string
            - type: 'null'
    ApiError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - code
            - message
          properties:
            type:
              type: string
              description: >-
                Broad category: invalid_request_error, authentication_error,
                not_found_error, rate_limit_error, api_error.
            code:
              type: string
              description: Machine-readable specific code.
            message:
              type: string
              description: Human-readable explanation, safe to surface in UI.
            param:
              type: string
              description: Field that triggered the error. Present on validation errors.
            details:
              type: object
              description: Free-form structured detail.
    ExportResult:
      type: object
      required:
        - url
        - entity
        - format
        - rows
        - bytes
        - truncated
        - expires_at
      properties:
        url:
          type: string
          format: uri
          description: >-
            Download URL. Unguessable, but not authenticated: anyone holding it
            can download the file until it expires.
        entity:
          type: string
          enum:
            - processes
            - actions
            - defendants
        format:
          type: string
          enum:
            - csv
            - jsonl
        rows:
          type: integer
          description: Rows written to the file.
        bytes:
          type: integer
          description: File size in bytes.
        truncated:
          type: boolean
          description: >-
            `true` when the 100,000-row cap was hit; the file is then not the
            complete dataset. Narrow the filters and export again.
        expires_at:
          type: string
          format: date-time
          description: >-
            The URL is guaranteed until this time (24 hours after completion)
            and removed shortly after.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Use Authorization: Bearer YOUR_API_KEY'

````