Create a Job

Creates a job representing a bulk operation and its associated data that is sent to Salesforce for asynchronous processing. Provide job data via an Upload Job Data request or as part of a multipart create job request.

URI: /services/data/vXX.X/jobs/ingest

Availability: This resource is available in API version 41.0 and later.

Formats: JSON

HTTP Method: POST

Authentication: Authorization: Bearer token

Parameters: None.

Headers: Optionally, use the Sforce-Call-Options header to specify a default namespace.

Request Body

PropertyTypeDescriptionRequired or Optional
assignmentRuleIdstringThe ID of an assignment rule to run for a Case or a Lead. The assignment rule can be active or inactive. The ID can be retrieved by using the Lightning Platform SOAP API or the Lightning Platform REST API to query the AssignmentRule object. This property is available in API version 49.0 and later. Not supported for refresh and consentImport.Optional
columnDelimiterColumnDelimiterEnumThe column delimiter used for CSV job data. The default value is COMMA. Valid values are:
  • BACKQUOTE—backquote character (`)
  • CARET—caret character (^)
  • COMMA—comma character (,) which is the default delimiter
  • PIPE—pipe character (|)
  • SEMICOLON—semicolon character (;)
  • TAB—tab character
Optional
contentTypeContentTypeThe content type for the job. The only valid value (and the default) is CSV.Optional
externalIdFieldNamestringThe external ID field in the object being updated. Only needed for upsert operations. Field values must also exist in CSV job data. For Marketing Object upsert, this property is not supported. The upsert matches on the record’s primary key. Not supported for the consentImport operation.Required for upsert operations
lineEndingLineEndingEnumThe line ending used for CSV job data, marking the end of a data row. The default is LF. Valid values are:
  • LF—linefeed character
  • CRLF—carriage return character followed by a linefeed character
Optional
objectstringThe object type for the data being processed. Use only a single object type per job. Specify the API name for marketing objects. Omit this property for the consentImport operation. Consent ingest isn’t backed by an object type. Including object with consentImport returns an error.Required
operationOperationEnumThe processing operation for the job. Valid values are:
  • insert
  • delete
  • hardDelete
  • update
  • upsert
  • refresh—Marketing Object ingest only.
  • consentImport—Consent ingest. Doesn’t require the object property.
Supported operations by target:
  • Standard objects: insert, delete, hardDelete, update, upsert
  • Marketing objects: insert, upsert, refresh
  • Consent ingest: consentImport
When the hardDelete value is specified, the deleted records aren’t stored in the Recycle Bin. Instead, they become immediately eligible for deletion. The permission for this operation, “Bulk API Hard Delete,” is disabled by default and must be enabled by an administrator. A Salesforce user license is required for hard delete.
Required

For multipart requests, the request body can also include CSV record data.

Response Body

PropertyTypeDescription
apiVersionstringThe API version that the job was created in.
assignmentRuleIdidThe ID of the assignment rule. This property is only shown if an assignment rule is specified when the job is created.
columnDelimiterColumnDelimiterEnumThe column delimiter used for CSV job data. Values include:
  • BACKQUOTE—backquote character (`)
  • CARET—caret character (^)
  • COMMA—comma character (,) which is the default delimiter
  • PIPE—pipe character (|)
  • SEMICOLON—semicolon character (;)
  • TAB—tab character
concurrencyModeConcurrencyModeEnumFor future use. How the request was processed. Currently only parallel mode is supported. (When other modes are added, the mode will be chosen automatically by the API and will not be user configurable.)
contentTypeContentTypeThe format of the data being processed. Only CSV is supported.
contentUrlURLThe URL to use for Upload Job Data requests for this job. Only valid if the job is in Open state.
createdByIdstringThe ID of the user who created the job.
createdDatedateTimeThe date and time in the UTC time zone when the job was created.
externalIdFieldNamestringThe name of the external ID field for an upsert.
idstringUnique ID for this job.
jobTypeJobTypeEnumThe job’s type. Values include:
  • BigObjectIngest—BigObjects job
  • Classic—Bulk API 1.0 job
  • V2Ingest—Bulk API 2.0 job
lineEndingLineEndingEnumThe line ending used for CSV job data. Values include:
  • LF—linefeed character
  • CRLF—carriage return character followed by a linefeed character
objectstringThe object type for the data being processed. Empty for jobs created with the consentImport operation.
operation The processing operation for the job. Values include:
  • insert
  • delete
  • hardDelete
  • update
  • upsert
  • refresh
  • consentImport
stateJobStateEnumThe current state of processing for the job. Values include:
  • Open—The job has been created, and data can be added to the job.
  • UploadComplete—No new data can be added to this job. You can’t edit or save this job, as Salesforce is processing it.
  • Aborted—The job has been aborted. You can abort a job if you created it or if you have the “Manage Data Integrations” permission.
  • JobComplete—The job was processed by Salesforce.
  • Failed—Some records in the job failed. Job data that was successfully processed isn’t rolled back.
systemModstampdateTimeDate and time in the UTC time zone when the job finished.

Usage Notes

For small amounts of job data (100,000 characters or less), you can create a job and upload all the data for a job using a multipart request. The following example request header and body uses a multipart format to contain both job information and job data.