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

# Create Contact Import

> Start an import from CSV text, or preview it with ``dry_run=true``.

A dry run writes and stores nothing and answers 200 with counts and the first 100
bad rows (type ``contact_import_previews``). A real run answers 201 with a
``queued`` import that a worker starts within about 30 seconds. An
``Idempotency-Key`` replay with the same body answers 200 with the stored import.
Limits: 10 MiB, 50,000 rows, one live import per team, 10 starts per hour.



## OpenAPI

````yaml /openapi/mio-openapi.json post /api/v1/teams/{team_id}/contacts/imports
openapi: 3.1.0
info:
  description: >-
    Production API reference for Membership.io. Use the authored guides for
    workflows and the generated endpoint pages for exact parameters and schemas.
  title: Membership.io API
  version: 0.1.0
servers:
  - description: Production
    url: https://api.member.dev
security:
  - bearerAuth: []
paths:
  /api/v1/teams/{team_id}/contacts/imports:
    post:
      tags:
        - contacts-admin
      summary: Create Contact Import
      description: >-
        Start an import from CSV text, or preview it with ``dry_run=true``.


        A dry run writes and stores nothing and answers 200 with counts and the
        first 100

        bad rows (type ``contact_import_previews``). A real run answers 201 with
        a

        ``queued`` import that a worker starts within about 30 seconds. An

        ``Idempotency-Key`` replay with the same body answers 200 with the
        stored import.

        Limits: 10 MiB, 50,000 rows, one live import per team, 10 starts per
        hour.
      operationId: >-
        contacts_admin.post_contacts_admin_post_teams_by_team_id_contacts_imports
      parameters:
        - in: path
          name: team_id
          required: true
          schema:
            title: Team Id
            type: string
        - in: header
          name: Idempotency-Key
          required: false
          schema:
            anyOf:
              - maxLength: 255
                minLength: 1
                type: string
              - type: 'null'
            title: Idempotency-Key
      requestBody:
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/ImportCreateEnvelope'
        required: true
      responses:
        '200':
          content:
            application/vnd.api+json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/ImportPreviewResponse'
                  - $ref: '#/components/schemas/ImportResponse'
                title: >-
                  Response 200 Contacts-Admin.Post Teams By Team Id Contacts
                  Imports
          description: Dry run (counts only), or an Idempotency-Key replay (the import).
        '201':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/ImportResponse'
          description: Successful Response
        '422':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - HTTPBearer: []
components:
  schemas:
    ImportCreateEnvelope:
      additionalProperties: false
      properties:
        data:
          $ref: '#/components/schemas/ImportCreateResource'
      required:
        - data
      title: ImportCreateEnvelope
      type: object
    ImportPreviewResponse:
      additionalProperties: false
      properties:
        data:
          $ref: '#/components/schemas/ImportPreviewResource'
      required:
        - data
      title: ImportPreviewResponse
      type: object
    ImportResponse:
      additionalProperties: false
      properties:
        data:
          $ref: '#/components/schemas/ImportResource'
      required:
        - data
      title: ImportResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ImportCreateResource:
      additionalProperties: false
      properties:
        attributes:
          $ref: '#/components/schemas/ImportCreateAttributes'
        type:
          const: contact_imports
          title: Type
          type: string
      required:
        - type
        - attributes
      title: ImportCreateResource
      type: object
    ImportPreviewResource:
      additionalProperties: false
      properties:
        attributes:
          $ref: '#/components/schemas/ImportPreviewAttributes'
        id:
          title: Id
          type: string
        type:
          const: contact_import_previews
          default: contact_import_previews
          title: Type
          type: string
      required:
        - id
        - attributes
      title: ImportPreviewResource
      type: object
    ImportResource:
      additionalProperties: false
      properties:
        attributes:
          $ref: '#/components/schemas/ImportAttributes'
        id:
          title: Id
          type: string
        links:
          anyOf:
            - $ref: '#/components/schemas/JsonApiLinks'
            - type: 'null'
        type:
          const: contact_imports
          default: contact_imports
          title: Type
          type: string
      required:
        - id
        - attributes
      title: ImportResource
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    ImportCreateAttributes:
      additionalProperties: false
      properties:
        csv:
          title: Csv
          type: string
        dry_run:
          default: false
          title: Dry Run
          type: boolean
        existing:
          default: update
          enum:
            - update
            - skip
          title: Existing
          type: string
        file_name:
          maxLength: 255
          minLength: 1
          title: File Name
          type: string
        mapping:
          additionalProperties:
            enum:
              - email
              - first_name
              - last_name
              - phone
              - skip
            type: string
          title: Mapping
          type: object
        marketing_consent:
          default: false
          title: Marketing Consent
          type: boolean
        tag_ids:
          items:
            format: uuid
            type: string
          maxItems: 50
          title: Tag Ids
          type: array
      required:
        - file_name
        - csv
        - mapping
      title: ImportCreateAttributes
      type: object
    ImportPreviewAttributes:
      additionalProperties: false
      properties:
        error_rows:
          items:
            $ref: '#/components/schemas/ErrorRow'
          title: Error Rows
          type: array
        error_rows_truncated:
          title: Error Rows Truncated
          type: boolean
        new_count:
          title: New Count
          type: integer
        row_count:
          title: Row Count
          type: integer
        skipped_count:
          title: Skipped Count
          type: integer
        updated_count:
          title: Updated Count
          type: integer
      required:
        - row_count
        - new_count
        - updated_count
        - skipped_count
        - error_rows
        - error_rows_truncated
      title: ImportPreviewAttributes
      type: object
    ImportAttributes:
      additionalProperties: false
      properties:
        created_at:
          format: date-time
          title: Created At
          type: string
        created_by_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By User Id
        created_count:
          title: Created Count
          type: integer
        error_rows:
          items:
            $ref: '#/components/schemas/ErrorRow'
          title: Error Rows
          type: array
        error_rows_truncated:
          title: Error Rows Truncated
          type: boolean
        existing:
          title: Existing
          type: string
        expires_at:
          format: date-time
          title: Expires At
          type: string
        file_name:
          title: File Name
          type: string
        finished_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Finished At
        marketing_consent:
          title: Marketing Consent
          type: boolean
        processed_rows:
          title: Processed Rows
          type: integer
        row_count:
          title: Row Count
          type: integer
        skipped_count:
          title: Skipped Count
          type: integer
        started_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Started At
        status:
          title: Status
          type: string
        tag_ids:
          items:
            type: string
          title: Tag Ids
          type: array
        updated_count:
          title: Updated Count
          type: integer
      required:
        - file_name
        - status
        - created_at
        - started_at
        - finished_at
        - created_by_user_id
        - row_count
        - processed_rows
        - created_count
        - updated_count
        - skipped_count
        - error_rows
        - error_rows_truncated
        - tag_ids
        - existing
        - marketing_consent
        - expires_at
      title: ImportAttributes
      type: object
    JsonApiLinks:
      properties:
        self:
          anyOf:
            - type: string
            - type: 'null'
          title: Self
      title: JsonApiLinks
      type: object
    ErrorRow:
      additionalProperties: false
      properties:
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
        reason:
          title: Reason
          type: string
        row:
          title: Row
          type: integer
      required:
        - row
        - reason
      title: ErrorRow
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT or mio_sk API key
      description: >-
        Send platform JWTs, contact JWTs, or team API keys as `Authorization:
        Bearer <token>`.
      scheme: bearer
      type: http
    HTTPBearer:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.