Create the import

POST /api/v1/import

Fist step of the import process, must be mapped before it can be started Must be of Content-Type multipart/form-data

Headers

multipart/form-data

Body Required

  • type string Required

    Type of record to import, available records are business_staff_members, charges, clients, group_scheme_members, notes, plans, premiums, tasks and valuations

  • mode string Required

    Type of import mode to enforce, available modes are store, update and validate

  • file string(binary) Required

    CSV file with import records

Responses

  • 200 application/json
    Hide response attributes Show response attributes object
    • uuid string

      The UUID of the resource.

    • The timestamp of when the resource was created.

    • The timestamp of when the resource was updated.

    • type string

      The type of model the importer is importing

    • mode string

      The mode this import was run on

    • headers array[string]

      Headers taken from uploaded csv, not visible on index route

    • mapping object

      Mapped headers, not visible on index route

    • status string

      The status of the importer

    • total_jobs integer

      Total amount of imports in the importer

    • progress integer

      The current progress of the importer

    • Number of pending imports

    • Number of failed imports

    • Error report file

    • errors object

      Array of failed imports, limited to 25 rows

    • account object

      Account that inititiated the import

POST /api/v1/import
curl \
 -X POST https://api.plannrcrm.com/api/v1/import \
 -H "Authorization: Bearer {OAUTH_ACCESS_TOKEN or PERSONAL_ACCESS_TOKEN}" \
 -H "Content-Type: multipart/form-data" \
 -H "Accept: application/json" \
 -F "type=clients" \
 -F "mode=store" \
 -F "file=@file"
Response examples (200)
{
  "mode": "store",
  "type": "clients",
  "uuid": "8fe0e696-f18f-4d17-995c-1853de405e6e",
  "errors": {
    "client": {
      "example": [],
      "description": "Client that failed importing"
    },
    "errors": {
      "example": {
        "send_welcome_email": [
          "The send welcome email field is required."
        ]
      },
      "description": "The reasons why the client failed importing"
    }
  },
  "status": "processing",
  "account": {
    "firm": "App\\Http\\Resources\\FirmResource",
    "name": "Gareth Thompson",
    "role": "client",
    "tags": "App\\Http\\Resources\\TagResource",
    "type": "client",
    "uuid": "746217ad-a4e7-4faf-aa76-e61e8cad3bc9",
    "email": "gareth@codepotato.co.uk",
    "groups": "App\\Http\\Resources\\GroupResource",
    "owners": "App\\Http\\Resources\\AccountResource",
    "last_name": "Thompson",
    "created_at": "2024-10-16T11:10:13+01:00",
    "first_name": "Gareth",
    "updated_at": "2024-10-16T11:10:13+01:00",
    "with_login": true,
    "custom_fields": "App\\Http\\Resources\\CustomFieldValueResource",
    "introduced_by": "App\\Http\\Resources\\AccountResource",
    "primary_email": "App\\Http\\Resources\\ContactDetailResource",
    "can_be_deleted": "false",
    "assigned_adviser": "App\\Http\\Resources\\AccountResource",
    "next_review_date": "2024-10-16T11:10:13+01:00",
    "has_joint_account": true,
    "current_time_entry": "App\\Http\\Resources\\TimeEntryResource",
    "first_contact_date": "2024-10-16T11:10:13+01:00",
    "external_references": "App\\Http\\Resources\\ExternalReferenceResource",
    "assigned_paraplanner": "App\\Http\\Resources\\AccountResource",
    "previous_review_date": "2024-10-16T11:10:13+01:00",
    "primary_phone_number": "App\\Http\\Resources\\ContactDetailResource",
    "assigned_administrator": "App\\Http\\Resources\\AccountResource",
    "anniversary_review_date": "2024-10-16T11:10:13+01:00"
  },
  "headers": [
    "fname",
    "lname",
    "email"
  ],
  "mapping": {
    "email": "email",
    "fname": "first_name",
    "lname": "last_name"
  },
  "progress": 100,
  "created_at": "2024-10-16T11:10:13+01:00",
  "total_jobs": 4,
  "updated_at": "2024-10-16T11:10:13+01:00",
  "failed_jobs": 1,
  "error_report": {
    "firm": "App\\Http\\Resources\\FirmResource",
    "name": "Welcome to Plannr",
    "size": "21691783",
    "tags": "App\\Http\\Resources\\TagResource",
    "type": "type",
    "uuid": "0b091b3f-a51e-4e19-ac53-69738e52b843",
    "parent": "Object",
    "status": "uploaded",
    "account": "App\\Http\\Resources\\AccountResource",
    "filename": "Welcome to Plannr.pdf",
    "progress": "100",
    "extension": "pdf",
    "created_at": "2024-10-16T11:10:13+01:00",
    "updated_at": "2024-10-16T11:10:13+01:00",
    "folder_name": "folder 2",
    "uploaded_at": "2024-10-16T11:10:13+01:00",
    "download_url": "https://plannr.valet/file/6607a6c6-3bc2-466c-92ad-4779c6b5db27/download",
    "last_modified": "2024-10-16T11:10:13+01:00",
    "original_created_at": "2024-10-16T11:10:13+01:00"
  },
  "jobs_remaining": 1
}