How Can We Help?
< All Topics
Print

API

API Reference

The PrintWatch API follows the REST specification. Our API accepts encoded requests and returns JSON responses that use the standard HTTP response codes in addition to custom code that are tabulated in section 2.0 below. The repository containing the client code for PrintWatch can be found in the PrintWatch repository

Getting Started?

Check out the developer quickstart guide.

1.0 Inference

The term Inference indicates that the user will be making API requests for the detection model to be applied to their image. In order to do this, follow steps 1.1 – 1.3 below.

1.1 Authentication

The PrintWatch API uses API keys to authenticate requests. You can manage your API keys from the confirmation email sent to your email after checkout.

Your API key will allow you to make simultaneous inference requests on the specified amount of devices for your plan. Multi-device plans use the same API key and limit you to the amount of devices allowed by your plan. See pricing.

Your API access keys should not be shared or distributed to anyone outside of your organization since they grant access to your PrintWatch resources. Do not share your API keys on debugging forums such as GitHub or Discord.

An example for an authenticated inference request is shown below:

A successful response for the above request will be in the form of:

The statusCode 200 indicates that the request worked as expected with no issues. The defect_detected property is a boolean value indicating the model’s detection of any defect in the image provided at the given confidence threshold. In the above example the model indicates that it has detected a defect with the True response for the defect_detected property.

2.0 HTTP Codes

In addition to using the standard HTTP codes, PrintWatch deploys custom response codes for special events, tabulated below:

HTTP CodeMessageDescription
210Issue with Image dataThe Image data included in the inference request is not in the correct format.
211Bad inference requestThere was an issue with the inference request or a post-processing algorithm. Use standard input parameters for the API request. If this issue persists, contact support.
212Settings check failedEither the API key is not valid, the printer is in use already, or you are making calls too frequently.
213Print time too soonInferencing begins after 5 minutes into the print jobs. Wait until the print job is 5 minutes or more into the print.
214New user addedThis is your first API request with a new API key or printer. Try the inference request again and the response code will be 200.
215Issue with payload dataThe payload does not contain the required information. Try setting the confidence and email settings.
216No inference criteria metUser does not have a valid API key or meet any of the criteria for inference.
217Invalid API keyUser does not have a valid API key
218Unavailable print timeThe print time has not been initialized by OctoPrint yet.
Next Custom Integration of the PrintWatch API
Table of Contents