---
title: "Create microdata resource generation job"
method: POST
path: "/jobs/generate_microdata_resource"
tags: ["Job Types"]
---

# Create microdata resource generation job

`POST /jobs/generate_microdata_resource`

Export project data files and create a dat/micro external resource in the background. Equivalent to POST /jobs with job_type generate_microdata_resource.

## Request body

- GenerateMicrodataResourceJobRequest
  - `project_id` integer, required — Project ID (sid)
  - `export_format` string, required — csv, dta, sav, xpt, or json
  - `export_version` string — Stata version when export_format is dta
  - `file_ids` string[] — Data file IDs; all files when omitted
  - `zip` boolean
  - `overwrite` boolean
  - `resource_id` integer — Regenerate an existing generated resource
  - `refresh_description` boolean
  - `max_wait_seconds` integer
  - `priority` integer
  - `max_attempts` integer

## Response `201`

Job created successfully

- JobCreateResponse
  - `status` string
  - `message` string
  - `uuid` string
  - `job` Job — Job object
    - `uuid` string
    - `job_type` 'generate_pdf' | 'generate_microdata_resource' | 'import_microdata' | 'import_indicator_data' | 'publish_project' | 'hello_world' — Registered background job type identifier
    - `status` 'pending' | 'held' | 'processing' | 'completed' | 'failed' — Current job status
    - `priority` integer — Job priority
    - `user_id` integer — User who initiated the job (NULL for system jobs)
    - `payload` union — Job-specific parameters; shape depends on job_type (see *JobPayload schemas)
      - GeneratePdfJobPayload — Payload for PDF generation job (used in generic /jobs endpoint)
        - `project_id` integer, required — Project ID for which to generate the PDF
        - `options` object — Optional PDF generation options
          - `template` string — PDF template to use (optional)
          - `format` string — PDF format options (optional)
      - GenerateMicrodataResourceJobPayload — Payload for generate_microdata_resource job (used in generic /jobs endpoint)
        - `project_id` integer, required — Project ID (sid)
        - `export_format` string, required — csv, dta, sav, xpt, or json
        - `export_version` string — Stata version when export_format is dta
        - `file_ids` string[]
        - `zip` boolean
        - `overwrite` boolean
        - `resource_id` integer — Regenerate an existing generated resource
        - `refresh_description` boolean
        - `max_wait_seconds` integer
      - ImportMicrodataJobPayload — Payload for microdata import job
        - `file_id` string, required — File ID of the uploaded data file to import
        - `project_id` string, required — Project ID where the data will be imported
      - ImportIndicatorDataJobPayload — Payload for import_indicator_data job (used in generic /jobs endpoint)
        - `project_id` integer, required — Project sid
        - `upload_id` string, required — Completed resumable upload ID
        - `indicator_value` string, required
        - `delimiter` string
        - `keep_extra_csv_columns` boolean
      - PublishProjectJobPayload — Payload for publish_project job (used in generic /jobs endpoint)
        - `project_id` union, required
          - integer
          - string
        - `catalog_connection_id` integer, required
        - `user_id` integer, required — User performing the publish (set automatically by convenience endpoint)
        - `publish_metadata` boolean
        - `publish_thumbnail` boolean
        - `publish_resources` boolean
        - `publish_dsd` boolean
        - `dsd_overwrite` boolean
        - `publish_indicator_data` boolean
        - `delete_nada_resources` boolean
        - `options` object
      - HelloWorldJobPayload — Payload for hello_world job (testing/demo; POST /jobs only)
        - `message` string — Optional greeting message
    - `result` union — Job result when completed; shape depends on job_type (see *JobResult schemas)
      - GeneratePdfJobResult — Result returned when PDF generation job completes successfully
        - `pdf_path` string — File path to the generated PDF
        - `project_id` integer — Project ID for which the PDF was generated
        - `generated_at` string, date-time — Timestamp when PDF was generated
      - GenerateMicrodataResourceJobResult — Result returned when microdata resource generation job completes
        - `status` 'success' | 'skipped'
        - `project_id` integer
        - `export_format` string
        - `resource_id` integer
        - `filename` string
        - `links_count` integer
        - `message` string — Present when status is skipped (resource already exists)
      - ImportMicrodataJobResult — Result returned when microdata import job completes successfully
        - `fastapi_job_id` string — FastAPI processing job ID
        - `file_id` string — File ID that was imported
        - `project_id` union — Project ID where data was imported
          - string
          - integer
        - `datafile_path` string — Path to the processed data file
        - `variables_imported` integer — Number of variables imported from the data dictionary
        - `case_count` integer, nullable — Row count from the data dictionary
        - `csv_file` string, nullable — Basename of the CSV file after cleanup
        - `fastapi_status` string
        - `message` string
      - ImportIndicatorDataJobResult — Result returned when indicator data import job completes successfully
        - `status` string
        - `indicator_value` string
        - `job_id` string — FastAPI replace-from-csv job ID
      - PublishProjectJobResult — Result returned when publish_project job completes
        - `results` object — Per-step publish outcomes (metadata, thumbnail, resources, dsd, etc.)
        - `errors` object — Non-fatal step errors keyed by step name
        - `project_id` union
          - integer
          - string
        - `catalog_connection_id` integer
        - `published_at` string, date-time
      - HelloWorldJobResult — Result returned when hello_world job completes
        - `message` string
        - `processed_at` string, date-time
        - `job_id` integer — Internal job queue ID
    - `error_message` string — Error details if job failed
    - `attempts` integer — Number of processing attempts
    - `max_attempts` integer — Maximum retry attempts
    - `created_at` string, date-time — Job creation timestamp
    - `started_at` string, date-time — Job processing start timestamp (null if not started)
    - `completed_at` string, date-time — Job completion timestamp (null if not completed)
    - `worker_id` string — Worker identifier processing this job (null if not processing)

## Other responses

- `400` — Bad request

---

[API](https://skmtc.net/worldbank/apis/metadata-editor-jobs-api.md) · [All operations](https://skmtc.net/worldbank/apis/metadata-editor-jobs-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/worldbank/metadata-editor-jobs-api/versions/7f334b22fc50/schema)
