When to use this endpoint

Replace the job-type code across a selection without changing each job’s form or answers.

Read the target jobs first with Jobs_getSome to obtain the current values and confirm the IDs belong to the intended account.

Authentication and permissions

Authenticate with signed API-key fields or a logged-in CRM session. Requests address physical job IDs in the authenticated account.

The legacy job-edit restriction bit 128 blocks the request with No permission to edit, including client administrators, matching the restricted focused setters. No additional assignee or department scope is applied.

Parameters

ParameterTypeRequiredDescription
type_idInteger stringYesRequired present value cast to integer; zero can clear the type. Negative and unknown IDs are not rejected or resolved against the job-type table.
idsNative arrayYesNative list of job IDs, converted individually with intval. This route requires a native array with scalar members and does not decode JSON strings.

Example request

$result = FM_api('Jobs_setType', ['type_id'=>'21', 'ids'=>['1042','1088']]);

Example response

{"errors":[]}

Errors and unusual responses

ResponseCondition
{"error":"not logged in"}No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs.
{"error":"missing or invalid parameter: type_id"}type_id is absent or null.
{"error":"missing or invalid parameter: ids"}ids is absent or null.
{"errors":["Job 1088 does not exist","Job 1042 is already the selected type."]}Missing/deleted/read-failed or unchanged jobs append messages; other IDs continue.
{"error":"missing or invalid parameter: ids"}ids is not a native array or contains nonscalar members; no JSON decoding is performed.
{"error":"No permission to edit"}The legacy job-edit restriction applies to this authenticated user.
{"error":"Unable to save job","failedId":1088,"updatedIds":[1042]}A primary write failed for failedId. updatedIds contains the earlier successfully written IDs, not a promise of an atomic batch.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • Requires authenticated tenant context via DBP. It enforces the legacy edit restriction but does not validate configured type IDs.
  • Processes IDs in supplied order without deduplication; duplicate IDs can produce already-selected messages after a first update.
  • Only type_id changes. Form links, answers, default-tax metadata, user assignment and recurrence are not recalculated.
  • Primary writes are checked. A failed write stops the batch with error, failedId and updatedIds (the successfully written prefix). Earlier writes remain committed; re-read the selected jobs before retrying.

Side effects

  • For changed jobs, advances last_edited/edited_uuid and invalidates the meetings cache.
  • Records job history. No outsourcing mirror, direct email or Workflow invocation occurs.

See it in Fieldmotion

CRM1

In CRM1 Jobs list select several rows, open the bulk-edit menu and choose Change Job type. jobsMultiEdit.js calls Jobs_setType; filter Network for that route.

CRM2

In CRM2 Jobs list select several rows, open the bulk-edit menu and choose Change Job type. lib/jobsMultiEdit.js calls Jobs_setType; filter Network for that route.

Related endpoints

  • Jobs_setFormId changes the form definition separately from the job type.
  • Jobs_getSome reads selected job records before editing and verifies the stored result afterward.