---
title: "Create data source upload URL"
method: POST
path: "/api/data-sources/upload-url"
tags: ["data_sources"]
---

# Create data source upload URL

`POST /api/data-sources/upload-url`

## Request

- Base URL: `https://beta.getsales.io/playtables/v1`
- URL: `https://beta.getsales.io/playtables/v1/api/data-sources/upload-url`
- Auth: HTTP bearer and API key in header `Team-SID`

The agent's way to upload a CSV, since a file cannot ride JSON: this mints a signed single-use URL and parks the import fields; then PUT the raw file bytes to it as the body (a plain HTTP request, Content-Type text/csv, no bearer), which creates the draft source exactly as upload-csv does and answers it with the header preview; then import_data_source on the draft sid confirms the mapping. Nothing exists until the PUT lands; the link dies in 15 minutes.

Contract:
- MCP tool `create_data_source_upload_url`, registry package `mcp.playtables/data_sources`, mount `playtables.sources`.
- Operation `action`, response envelope `action`.
- Flags: none.

## Request body

- CreateDataSourceUploadUrlRequest: Request body of `create_data_source_upload_url`.
  - `playtable_sid` string, required: Target table (pt_tb_…) the draft feeds; checked at the mint, a missing or foreign one is 422 relation_not_found before any bytes travel.
  - `object_type` 'people' | 'company': What the rows become: people (default) | company; import_data_source may still override it.
  - `mode` 'create' | 'update': What the import does with them: create (default) | update; import_data_source may still override it.
  - `name` string: The draft's name; default: the file name the PUT declares in Content-Disposition, else upload.csv.
  - `tag_sids` string[]: Tags every promoted row gets (cr_tg_…, must exist in the team; checked at the mint).
  - `qualify` object, nullable: The source gate, Check on save: {on, criterion}; null or absent = no check. import_data_source may still set it.
    - `on` boolean, required: The switch. `on` with no criterion is refused (422 on qualify.criterion, rule required_if).
    - `criterion` string, nullable, required: Who passes, in the user's words ("a decision maker at a marketing agency, not a freelancer"). Trimmed; null while the check is off.
  - `on_duplicate` 'skip' | 'move': skip (default) | move: what a person already in another table does.
  - `add_tags_to_duplicate` boolean: Merge tag_sids onto a matched duplicate; default false.

## Response `200`

`action` success envelope.

- CreateDataSourceUploadUrlResponse
  - `success` true, required
  - `operation` 'action', required
  - `action` string, required: kebab-case verb; matches the route segment.
  - `item` unknown, required
  - `result` object, required
    - `upload_url` string, required: The signed URL to PUT the bytes to, used exactly as given (the signature covers the path and the query); one use, then gone.
    - `method` 'PUT', required
    - `expires_at` string, required: ISO 8601 UTC: the link stops working here, 15 minutes after the mint; mint again after it.
    - `max_bytes` integer, required: The body cap in bytes (51200 KB, the multipart rule); a larger PUT is 422 on file.
    - `content_types` string[], required: The Content-Type values the PUT accepts (text/csv, text/plain); the bytes are sniffed too, so a non-CSV body is 422 whatever it declares.
  - `meta` object, required
    - `trace_id` string, required: UUID v7; same 128-bit value as the X-Trace-Id header.
    - `span_id` string, required: 16 hex chars, root span of this request.
    - `timestamp` string, required: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
    - `duration_ms` integer, required: Server-side wall clock.
    - `team_sid` string, nullable: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
    - `actor_type` string, nullable: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.

## Other responses

- `4XX`: MCP error envelope. `error.code` is one of validation_failed, nothing_to_update, not_found, relation_not_found, invalid_transition, limit_exceeded, payment_required, duplicate_rejected, conflict, delete_blocked, unauthorized, forbidden, rate_limited, not_implemented.
- `5XX`: MCP error envelope with `error.code` internal_error or service_unavailable.

---

[API](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-playtables.md) - [All operations](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-playtables/llms.txt) - [OpenAPI document](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-playtables/revisions/aa394506515d?raw)
