---
title: "Mark P4 import as stopped"
method: POST
path: "/repos/{repo_id}/p4-import-state/mark-stopped"
tags: ["Perforce Repository Import"]
---

# Mark P4 import as stopped

`POST /repos/{repo_id}/p4-import-state/mark-stopped`

## Request

- Base URL: `https://api.diversion.dev/v0`
- URL: `https://api.diversion.dev/v0/repos/{repo_id}/p4-import-state/mark-stopped`
- Auth: OAuth 2
  - Implicit: `https://auth.diversion.dev/oauth2/authorize`
  - Scopes: `coreapi/write`
- TypeScript: <https://skmtc.dev/diversion/apis/diversion-core-api/docs/repos/:repo_id/p4-import-state/mark-stopped/post.ts> (a function with typed inputs; its response is checked against the schema)

Mark the Perforce import job as no longer running by clearing the running_job_id and started_unix timestamp. This should be called when a continuous import job completes or stops. The job will only be marked as stopped if the current running_job_id matches the one in the database to prevent race conditions.

## Request body

- P4ImportJobResult: Details of a Perforce continuous import job
  - `last_changelist` integer: Last Perforce changelist number that was imported
  - `last_import_unix` integer, nullable: Unix timestamp of the last successful import
  - `running_job_id` string, nullable: ID of the currently running import job, if any
  - `error_count` integer: Number of consecutive errors encountered
  - `last_error` string, nullable: Last error message encountered during import
  - `last_error_unix` integer, nullable: Unix timestamp of the last error

## Response `204`

Request completed successfully

## Other responses

- `400`: The request does not meet the required conditions
- `404`: The specified resource was not found
- `default`: An error occurred

---

[API](https://skmtc.dev/diversion/apis/diversion-core-api.md) - [All operations](https://skmtc.dev/diversion/apis/diversion-core-api/llms.txt) - [OpenAPI document](https://skmtc.dev/diversion/apis/diversion-core-api/revisions/38a18aba804b?raw)
