Skip to content

End a process

Reports that a copy of your application stopped. The process slot is then free for another copy.

POST /v1/processes/exit

When to exit

Report the exit when your application closes. Send the same process ID as in the spawn.

If your application stops without an exit, for example after a crash, the slot is free when the lease of the process ends. This takes at most the process interval plus the process grace. See Leases.

Validity

An exit does not check the license. It also works on an expired or suspended license. So your application can always free its slot when it closes.

Effects

  • Seatify removes the process. The slot is free immediately, and another copy can spawn.
  • An exit does not change the device binding. The device keeps its slot on the license.
  • A later spawn with the same process ID registers a new process.
  • Seatify records each exit in the activity of the license, a refused one too. See Activity.

Authentication

Send the publishable key of the product. See Authentication.

Request

HeaderRequiredDescription
Seatify-Publishable-KeyYesThe publishable key of the product.
Content-TypeYesAlways application/json.
Seatify-NonceNoA new random value that the signature includes. See Signed responses.
Seatify-Signing-KeyNoThe key ID of the signing key in your application. See Signed responses.
FieldTypeRequiredDescription
keystringYesThe license key.
deviceobjectYesThe device that the process runs on.
processobjectYesThe process to end.

The device object has these fields:

FieldTypeRequiredDescription
fingerprintstringYesThe fingerprint that the device sent in its claim. The fingerprint is case-sensitive. See Devices.
hostnamestringNoThe name of the device. An exit does not store the name. So your application can send the same device object as in the claim.

The process object has these fields:

FieldTypeRequiredDescription
pidstringYesThe process ID that your application sent in the spawn. The process ID is case-sensitive.

A device object or a process object with no values counts as missing.

Response

The answer is not a license check object. It has only these fields:

FieldTypeDescription
exitedbooleantrue if Seatify removed the process.
reasonstringThe cause when exited is false. It is null when exited is true.

The answer does not show the state of the license. Validate the license to get it.

Reasons

A refused exit answers with the status 200, exited set to false and a reason. The refused exit does not change the license or its processes.

ReasonDescription
license_not_foundNo license has this key.
product_mismatchThe license belongs to another product.
not_claimedThe device has no binding on this license, or its heartbeat lease has ended. The processes of the device ended with the binding.
process_not_spawnedThe device has no running process with this process ID. The process exited before, or its lease has ended.

After not_claimed or process_not_spawned, the process holds no slot. No action is needed.

See Reasons.

Errors

StatusReasonDescription
400The request body could not be read.The body is not valid JSON, or the process ID is not a string.
400The submitted details are not valid.A field is not valid. The errors field names it. See the table below.
400The signing key is not known.Your organization has no signing key with the ID in Seatify-Signing-Key.
400The nonce must be at most 255 characters.The value of Seatify-Nonce is too long.
401A publishable key is required.The request has no Seatify-Publishable-Key header, or the header is empty.
401The publishable key is not valid.No product has this key.
429There are too many requests. Try again later.See Rate limits.

These fields can be in errors:

FieldDescription
keyThe license key is missing or too long.
deviceThe request has no device.
device.fingerprintThe device object has no fingerprint, or the fingerprint is too long.
device.hostnameThe hostname is too long.
processThe request has no process.
process.pidThe process ID is too long.

See Errors.

Example

curl https://license.seatify.dev/v1/processes/exit \
  -H "Seatify-Publishable-Key: $SEATIFY_PUBLISHABLE_KEY" \
  -H "Content-Type: application/json" \
  --data @- <<EOF
{
  "key": "$LICENSE_KEY",
  "device": { "fingerprint": "$DEVICE_FINGERPRINT" },
  "process": { "pid": "$PROCESS_ID" }
}
EOF
{
  "exited": true,
  "reason": null
}