Skip to main content
POST
Report a failed completion

Overview

Report failed or problematic completions to help improve Morph’s quality. This endpoint allows you to flag completions that produced incorrect, malformed, or problematic code so our team can investigate and improve the models. When to use this endpoint:
  • Generated code has syntax errors
  • Applied changes broke existing functionality
  • Model output doesn’t match the intended instruction
  • Generated code produces runtime errors or exceptions
  • Code quality issues (security vulnerabilities, bad practices)
The completion ID can be found in the response headers (x-completion-id) or server logs from your original apply request.

Request Body

string
required
The completion ID from the original request (found in response headers or logs)
string
required
Description of what went wrong (Error message, traceback, etc.)
string
The original user instruction that led to the problematic completion. This helps provide context for debugging and improving the model. Maximum 2000 characters.

Response

boolean
Whether the report was successfully recorded
string
Confirmation message
object

Error Codes

Examples

cURL

JavaScript (fetch)

Python (requests)

Node.js (axios)

Response Example

Successful response (200 OK):
Error response (400 Bad Request):

Authorizations

Authorization
string
header
required

Morph API key, passed as Authorization: Bearer sk-.... Create keys at https://www.morphllm.com/dashboard/api-keys.

Body

application/json

Report request for failed completion

A single problematic completion, identified by id and described by its failure.

completion_id
string
required

The completion ID from the original request (found in response headers or logs)

Example:

"chatcmpl-9d9e2fc21c094f4eacbcee0009f2f12d"

failure_reason
string
required

Description of what went wrong (Error message, traceback, etc.)

Example:

"Traceback: ... Generated code had syntax errors"

user_query
string

Optional: The original user instruction that led to the problematic completion

Maximum string length: 2000
Example:

"Add error handling to the login function"

Response

Report successfully recorded

Acknowledgement that the report was stored, with the internal record id.

success
boolean
required

Whether the report was successfully recorded

Example:

true

message
string
required

Confirmation message

Example:

"Report successfully recorded"

data
object

Additional response data

Example: