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

# Create a CSV export

> Unified export endpoint. Small requests return 200 text/csv inline; large requests
create a durable async job and return 202 + status url. Idempotency-Key is optional but
recommended: send the same key on every retry of a create so a lost response can't spawn a
duplicate job (the client can't know the delivery mode in advance). Omit it and the request
still succeeds, just without that retry-safety.



## OpenAPI

````yaml /openapi-v1.json post /place_enrichment/exports
openapi: 3.1.0
info:
  title: Reprompt Place Enrichment API
  description: >

    ## Batch Processing Guide


    The `/place_enrichment/batches` endpoint allows you to submit multiple
    places in a single batch for attribute enrichment. 

    The batch will be processed asynchronously, and you can track its status
    using the returned batch ID.



    #### Typical workflow:

    1. Prepare your batch payload with:
       - A unique batch name for identification
       - List of places with their IDs and input data
       - Optional attribute set specification
    2. Submit the batch using the POST `/place_enrichment/batches` endpoint

    3. Use the returned batch ID to:
       - Check batch status at GET `/place_enrichment/batches/{batch_id}`
       - Retrieve results at GET `/place_enrichment/jobs?batchId={batch_id}`


    #### Submitting a Batch:


    Use POST `/place_enrichment/batches` to submit a batch.


    **Example Batch Payload:**

    ```json

    {
        "batch_name": "NYC Restaurants March 2024",
        "attributes": ["websites", "phoneNumbers", "socialHandles", "openingHours", "categories", "closed_permanently"], 
        "jobs": [
            {
                "place_id": "place_nyc_123",
                "inputs": {
                    "name": "Joe's Pizza",
                    "latitude": 40.7359,
                    "longitude": -73.9911,
                    "full_address": "7 Carmine St, New York, NY 10014",
                    "street": "Carmine St",
                    "city": "New York",
                    "state": "NY",
                    "postalCode": "10014",
                    "house": "7",
                    "country": "United States",
                    "country_code": "US",
                    "type": "restaurant",
                    "website": "http://www.joespizzanyc.com",
                    "phone": "+12122555803"
                }
            }
        ]
    }

    ```

    **Place Input Parameters:**

    For more details on the place input parameters, see the ```UniversalPlace```
    schema in the schemas section below.


    **Attributes:**


    The `attributes` parameter in your request specifies which attributes will
    be enriched. You can specify individual attributes like:


    - `["websites", "phoneNumbers"]` - Only enrich website and phone information

    - `["closed_permanently"]` - Only check if the business is permanently
    closed

    - `["websites", "phoneNumbers", "socialHandles", "openingHours",
    "categories", "closed_permanently"]` - Core business attributes

    - `["websites", "phoneNumbers", "socialHandles", "openingHours",
    "categories", "closed_permanently", "cuisine", "price_tier", "menu_url"]` -
    Comprehensive enrichment


    For a full list of available attributes, see the enrichment schema
    documentation below.


    **`attribute_set`:** Deprecated preset for common enrichment requests.
    Prefer an explicit `attributes` list. `open_closed` checks whether a place
    is open or permanently closed, while `core` and `all` both request
    `closed_permanently`, `websites`, `phoneNumbers`, `openingHours`, `names`,
    `address`, and `categories`.


    #### Tracking Batch Status:


    Use GET `/place_enrichment/batches/{batch_id}` to monitor the progress of
    your batch. The response includes:


    ```json

    {
        "id": "batch_2024_03_15_123456",
        "batch_name": "NYC Restaurants March 2024",
        "status": "in_progress",
        "jobs": {
            "pending": ["place_id_2", "place_id_3"],
            "in_progress": ["place_id_1"],
            "completed": ["place_id_4", "place_id_5"],
            "failed": []
        },
        "created_at": "2024-03-15T10:30:00Z",
        "updated_at": "2024-03-15T10:35:00Z"
    }

    ```


    The status field will be one of:

    - `pending`: Batch is queued but not yet started

    - `in_progress`: Batch is currently being processed

    - `completed`: All jobs in the batch are finished

    - `failed`: Batch encountered critical errors


    #### Retrieving Job Results:


    Once jobs are completed, use GET `/place_enrichment/jobs?batchId={batch_id}`
    to get the enrichment results. The response includes:


    ```json

    {
        "jobs": [
            {
                "place_id": "place_nyc_123",
                "status": "completed",
                "outputs": {
                    "website": "https://www.joespizzanyc.com",
                    "phone": "+12122555803",
                    "social_profiles": {
                        "instagram": "joespizzanyc",
                        "facebook": "joespizzanyc"
                    },
                    "open_closed_status": "Open",
                    "price_tier": "$$",
                    "last_enriched": "2024-03-15T10:35:00Z"
                },
                "job_metadata": {
                    "created_at": "2024-03-15T10:30:00Z",
                    "completed_at": "2024-03-15T10:35:00Z",
                    "processing_time_seconds": 300
                }
            }
        ],
        "total_count": 1,
        "completed_count": 1
    }

    ```


    Each job result includes:

    - Original place ID for tracking

    - Enrichment outputs based on the requested attribute set

    - Job metadata including timing information

    - Processing status and any error details if failed


    **Attribute Statuses:**


    Attributes like name, address, phone number, and website include an
    `attribute_status` field indicating the verification state:


    | Status | Description |

    |--------|-------------|

    | NOT_RUN | The attribute was not processed |

    | RUN_CONDITION_FAILED | The attribute was processed but failed the run
    condition |

    | RUN | The attribute was processed |

    | ERROR | The attribute processing failed |


    Example response with attribute statuses:

    ```json

    {
        "outputs": {
            "website": "https://www.joespizzanyc.com",
            "phone": "+12122555803"
        },
        "job_metadata": {
            "attribute_status": {
                "website": "RUN",
                "phone": "RUN",
                "address": "RUN",
                "name": "RUN"
            }
        }
    }

    ```
  version: '1.0'
servers:
  - url: https://api.repromptai.com/v1/{org}
    variables:
      org:
        default: reprompt
        description: The organization slug to use for the API
security: []
paths:
  /place_enrichment/exports:
    post:
      tags:
        - exports
      summary: Create a CSV export
      description: >-
        Unified export endpoint. Small requests return 200 text/csv inline;
        large requests

        create a durable async job and return 202 + status url. Idempotency-Key
        is optional but

        recommended: send the same key on every retry of a create so a lost
        response can't spawn a

        duplicate job (the client can't know the delivery mode in advance). Omit
        it and the request

        still succeeds, just without that retry-safety.
      operationId: create_place_enrichment_export__org_slug__place_enrichment_exports_post
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Idempotency-Key
        - name: apiKey
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Apikey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateExportRequest'
      responses:
        '200':
          description: >-
            Sync delivery: the CSV is returned inline (small exports under the
            size gate).
          content:
            application/json:
              schema: {}
            text/csv: {}
        '202':
          description: >-
            Async delivery: a durable job was created (or an existing one
            matched by Idempotency-Key); poll `status_url` until status is
            completed, then follow `download_url`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExportStatusResponse'
        '404':
          description: One or more batch_ids are not found for this organization.
        '409':
          description: Idempotency-Key was already used with a different set of batch_ids.
        '502':
          description: Failed to dispatch the export worker; the job row is marked failed.
      security:
        - HTTPBearer: []
components:
  schemas:
    CreateExportRequest:
      properties:
        batch_ids:
          items:
            type: string
          type: array
          minItems: 1
          title: Batch Ids
          description: Batch IDs to export (must be owned by the org).
          example:
            - batch_2024_03_15_123456
            - batch_2024_03_16_654321
      type: object
      required:
        - batch_ids
      title: CreateExportRequest
    ExportStatusResponse:
      properties:
        id:
          type: string
          title: Id
          description: Unique export identifier.
          example: exp_2f0ce4cf
        status:
          type: string
          title: Status
          description: queued | running | completed | failed | expired.
          example: completed
        batch_ids:
          items:
            type: string
          type: array
          title: Batch Ids
          description: Batch IDs included in this export.
          example:
            - batch_2024_03_15_123456
        batch_names:
          additionalProperties:
            type: string
          type: object
          title: Batch Names
          description: >-
            Best-effort {batch_id -> name} map; a batch id is omitted if its
            name could not be resolved.
          example:
            batch_2024_03_15_123456: NYC Restaurants March 2024
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
          description: ISO-8601 creation timestamp.
        updated_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Updated At
          description: ISO-8601 last-update timestamp.
        status_url:
          type: string
          title: Status Url
          description: Relative URL to poll this export's status.
          example: /place_enrichment/exports/exp_2f0ce4cf
        download_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Download Url
          description: >-
            Relative download URL; present only while status is completed and
            unexpired.
          example: /place_enrichment/exports/exp_2f0ce4cf/download
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Failure reason when status is failed.
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: >-
            Worker-reported stats (row counts, per-stage timings) once
            available.
        expired:
          type: boolean
          title: Expired
          description: True when a completed export has aged past its retention window.
          example: false
      type: object
      required:
        - id
        - status
        - batch_ids
        - status_url
        - expired
      title: ExportStatusResponse
      description: >-
        Status of a durable CSV export job. Returned by the async create path
        (202), the status

        endpoint, and as each element of the list endpoint. `status` is one of
        queued/running/

        completed/failed, or `expired` once a completed export passes its
        retention window (at which

        point `download_url` is null and the download route returns 410).
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````