Articles on: Developer API

Writing Style Replication API

Try it Out


You can test out the API without code by going to the FastAPI link with your web browser: https://style.undetectable.ai/docs


Authentication


Undetectable.AI uses API keys to allow access to the API. You can get your API key at the top of the page in our developer portal.


UD expects the API key to be included in all API requests to the server in a header that looks like the following:


x-api-key: YOUR API KEY GOES HERE or apikey: YOUR API KEY GOES HERE


You must replace YOUR API KEY GOES HERE with your personal API key.


Writing Style Replication API


The Writing Style Replication API provides a simple, stateless approach to generating content with custom writing styles. This is ideal for users who want a straightforward request-response model.


Writing Style Management


Get Preset Writing Styles


Retrieve a list of predefined writing styles available in the system.


GET https://style.undetectable.ai/writing-style-presets


Example Request


curl -X GET 'https://style.undetectable.ai/writing-style-presets' \
--header 'x-api-key: YOUR API KEY GOES HERE'


Example Response


[
{
"id": "6789c112-d6ff-4151-8fd5-1ad6aa72c8b8",
"name": "CEO"
},
{
"id": "6afb19ba-e7f4-448d-ac2d-57a8cb47bc4b",
"name": "Journalist"
}
]



Create Writing Style


Create a custom writing style by providing a name and sample input text that represents the desired writing pattern.


POST https://style.undetectable.ai/writing-styles


Example Request


curl -X POST 'https://style.undetectable.ai/writing-styles' \
--header 'x-api-key: YOUR API KEY GOES HERE' \
--header 'Content-Type: application/json' \
--data '{
"name": "Einstein",
"input": "Ladies and gentlemen, esteemed colleagues, the matter before us today is not merely a question of legality—it is a question of principle, of justice, and of the integrity of the system we are sworn to uphold.\n\nLet us be clear: the facts are not in dispute. The record shows that the defendant acted with full knowledge of the consequences, having been warned, counseled, and made aware of the risks. Yet, despite these clear indicators, they proceeded in a manner that was not only reckless but demonstrably harmful.\n\nNow, opposing counsel may attempt to cast doubt, to blur lines, to confuse responsibility. But the law does not bend to convenience, nor does it flinch in the face of ambiguity. It seeks clarity. It demands accountability.\n\nWe are not here to render judgment based on emotion or speculation. We are here to apply the law—impartially, objectively, and without fear or favor.\n\nTherefore, I urge you to consider the evidence, to apply the standard of reason, and to arrive at the only conclusion that the facts and the law will allow—that the defendant must be held liable, and justice must be served.\n\nThank you."
}'


Example Response


{
"id": "9940dfce-3346-463b-a63d-691e756b031b",
"name": "Einstein",
"input": "Ladies and gentlemen, esteemed colleagues, the matter before us today is not merely a question of legality—it is a question of principle, of justice, and of the integrity of the system we are sworn to uphold.\n\nLet us be clear: the facts are not in dispute. The record shows that the defendant acted with full knowledge of the consequences, having been warned, counseled, and made aware of the risks. Yet, despite these clear indicators, they proceeded in a manner that was not only reckless but demonstrably harmful.\n\nNow, opposing counsel may attempt to cast doubt, to blur lines, to confuse responsibility. But the law does not bend to convenience, nor does it flinch in the face of ambiguity. It seeks clarity. It demands accountability.\n\nWe are not here to render judgment based on emotion or speculation. We are here to apply the law—impartially, objectively, and without fear or favor.\n\nTherefore, I urge you to consider the evidence, to apply the standard of reason, and to arrive at the only conclusion that the facts and the law will allow—that the defendant must be held liable, and justice must be served.\n\nThank you.\n\n",
"status": "pending"
}



Get Writing Style


Retrieve details of a specific writing style by its ID.


GET https://style.undetectable.ai/writing-styles/{writing_style_id}


Example Request


curl -X GET 'https://style.undetectable.ai/writing-styles/9940dfce-3346-463b-a63d-691e756b031b' \
--header 'x-api-key: YOUR API KEY GOES HERE'


Example Response


{
"id": "9940dfce-3346-463b-a63d-691e756b031b",
"name": "Einstein",
"input": "Ladies and gentlemen, esteemed colleagues, the matter before us today is not merely a question of legality—it is a question of principle, of justice, and of the integrity of the system we are sworn to uphold.\n\nLet us be clear: the facts are not in dispute. The record shows that the defendant acted with full knowledge of the consequences, having been warned, counseled, and made aware of the risks. Yet, despite these clear indicators, they proceeded in a manner that was not only reckless but demonstrably harmful.\n\nNow, opposing counsel may attempt to cast doubt, to blur lines, to confuse responsibility. But the law does not bend to convenience, nor does it flinch in the face of ambiguity. It seeks clarity. It demands accountability.\n\nWe are not here to render judgment based on emotion or speculation. We are here to apply the law—impartially, objectively, and without fear or favor.\n\nTherefore, I urge you to consider the evidence, to apply the standard of reason, and to arrive at the only conclusion that the facts and the law will allow—that the defendant must be held liable, and justice must be served.\n\nThank you.\n\n",
"status": "done"
}



Update Writing Style


Update an existing writing style's name or input text.


PUT https://style.undetectable.ai/writing-styles/{writing_style_id}


Example Request


curl -X PUT 'https://style.undetectable.ai/writing-styles/9940dfce-3346-463b-a63d-691e756b031b' \
--header 'x-api-key: YOUR API KEY GOES HERE' \
--header 'Content-Type: application/json' \
--data '{
"name": "Einstein Version 2",
"input": "Ladies and gentlemen, esteemed colleagues,\nWhat we are confronted with today is not merely a matter of legality—it is a matter of principle, of justice, and of the integrity of the very system we are entrusted to uphold.\n\nLet there be no confusion: the facts are clear and uncontested. The record plainly shows that the defendant acted with full awareness of the consequences. They were warned, advised, and made fully aware of the risks. Yet, despite this, they chose a path that was not only irresponsible but demonstrably harmful.\n\nThe opposing counsel may attempt to sow doubt, to obscure the facts, or to shift the burden. But the law is not a tool of convenience. It does not yield to uncertainty, nor does it falter in the face of distraction. The law seeks truth. It demands accountability.\n\nWe are not here to pass judgment on sentiment or conjecture. We are here to apply the law—fairly, objectively, and without bias.\n\nSo I urge you: examine the evidence, apply reason, and come to the only conclusion that justice and the facts support—that the defendant must be held accountable, and that justice must prevail.\n\nThank you."
}'


Example Response


{
"id": "9940dfce-3346-463b-a63d-691e756b031b",
"name": "Einstein Version 2",
"input": "Ladies and gentlemen, esteemed colleagues,\nWhat we are confronted with today is not merely a matter of legality—it is a matter of principle, of justice, and of the integrity of the very system we are entrusted to uphold.\n\nLet there be no confusion: the facts are clear and uncontested. The record plainly shows that the defendant acted with full awareness of the consequences. They were warned, advised, and made fully aware of the risks. Yet, despite this, they chose a path that was not only irresponsible but demonstrably harmful.\n\nThe opposing counsel may attempt to sow doubt, to obscure the facts, or to shift the burden. But the law is not a tool of convenience. It does not yield to uncertainty, nor does it falter in the face of distraction. The law seeks truth. It demands accountability.\n\nWe are not here to pass judgment on sentiment or conjecture. We are here to apply the law—fairly, objectively, and without bias.\n\nSo I urge you: examine the evidence, apply reason, and come to the only conclusion that justice and the facts support—that the defendant must be held accountable, and that justice must prevail.\n\nThank you.",
"status": "pending"
}



Get All Writing Styles


Retrieve a list of all writing styles associated with your account.


GET https://style.undetectable.ai/writing-styles


Example Request


curl -X GET 'https://style.undetectable.ai/writing-styles' \
--header 'x-api-key: YOUR API KEY GOES HERE'


Example Response


[
{
"id": "9940dfce-3346-463b-a63d-691e756b031b",
"name": "Einstein",
"input": "Ladies and gentlemen, esteemed colleagues,\nWhat we are confronted with today is not merely a matter of legality—it is a matter of principle, of justice, and of the integrity of the very system we are entrusted to uphold.\n\nLet there be no confusion: the facts are clear and uncontested. The record plainly shows that the defendant acted with full awareness of the consequences. They were warned, advised, and made fully aware of the risks. Yet, despite this, they chose a path that was not only irresponsible but demonstrably harmful.\n\nThe opposing counsel may attempt to sow doubt, to obscure the facts, or to shift the burden. But the law is not a tool of convenience. It does not yield to uncertainty, nor does it falter in the face of distraction. The law seeks truth. It demands accountability.\n\nWe are not here to pass judgment on sentiment or conjecture. We are here to apply the law—fairly, objectively, and without bias.\n\nSo I urge you: examine the evidence, apply reason, and come to the only conclusion that justice and the facts support—that the defendant must be held accountable, and that justice must prevail.\n\nThank you.",
"status": "done"
},
{
"id": "9db2c3be-4f18-4f93-a058-3d24ec5b1abb",
"name": "Einstein Version 2",
"input": "Ladies and gentlemen, esteemed colleagues,\nWhat we are confronted with today is not merely a matter of legality—it is a matter of principle, of justice, and of the integrity of the very system we are entrusted to uphold.\n\nLet there be no confusion: the facts are clear and uncontested. The record plainly shows that the defendant acted with full awareness of the consequences. They were warned, advised, and made fully aware of the risks. Yet, despite this, they chose a path that was not only irresponsible but demonstrably harmful.\n\nThe opposing counsel may attempt to sow doubt, to obscure the facts, or to shift the burden. But the law is not a tool of convenience. It does not yield to uncertainty, nor does it falter in the face of distraction. The law seeks truth. It demands accountability.\n\nWe are not here to pass judgment on sentiment or conjecture. We are here to apply the law—fairly, objectively, and without bias.\n\nSo I urge you: examine the evidence, apply reason, and come to the only conclusion that justice and the facts support—that the defendant must be held accountable, and that justice must prevail.\n\nThank you.",
"status": "done"
}
]



Delete Writing Style


Delete a specific writing style from your account.


DELETE https://style.undetectable.ai/writing-styles/{writing_style_id}


Example Request


curl -X DELETE 'https://style.undetectable.ai/writing-styles/9940dfce-3346-463b-a63d-691e756b031b' \
--header 'x-api-key: YOUR API KEY GOES HERE'


Example Response


{
"id": "9940dfce-3346-463b-a63d-691e756b031b",
"name": "Einstein",
"input": "Ladies and gentlemen, esteemed colleagues,\nWhat we are confronted with today is not merely a matter of legality—it is a matter of principle, of justice, and of the integrity of the very system we are entrusted to uphold.\n\nLet there be no confusion: the facts are clear and uncontested. The record plainly shows that the defendant acted with full awareness of the consequences. They were warned, advised, and made fully aware of the risks. Yet, despite this, they chose a path that was not only irresponsible but demonstrably harmful.\n\nThe opposing counsel may attempt to sow doubt, to obscure the facts, or to shift the burden. But the law is not a tool of convenience. It does not yield to uncertainty, nor does it falter in the face of distraction. The law seeks truth. It demands accountability.\n\nWe are not here to pass judgment on sentiment or conjecture. We are here to apply the law—fairly, objectively, and without bias.\n\nSo I urge you: examine the evidence, apply reason, and come to the only conclusion that justice and the facts support—that the defendant must be held accountable, and that justice must prevail.\n\nThank you.",
"status": "done"
}



Request Content in Writing Style


Generate content using a specific writing style.


POST https://style.undetectable.ai/requests


Example Request


curl -X POST 'https://style.undetectable.ai/requests' \
--header 'x-api-key: YOUR API KEY GOES HERE' \
--header 'Content-Type: application/json' \
--data '{
"writingStyleId": "6afb19ba-e7f4-448d-ac2d-57a8cb47bc4b",
"input": "What is the likelihood of lightning striking the same point more than once?",
"humanized": false
}'


Example Response


{
"id": "request-uuid-here",
"input": "What is the likelihood of lightning striking the same point more than once?",
"humanized": false,
"writingStyleId": "6afb19ba-e7f4-448d-ac2d-57a8cb47bc4b",
"status": "pending",
"output": null,
"assistantOutput": null,
"humanizedOutput": null,
"createdDate": "2025-07-09T15:31:54.591615",
"modifiedDate": "2025-07-09T15:31:54.591618"
}


Request Parameters


  • writingStyleId: ID of the writing style to use for content generation (required)
  • input: The input prompt or question (required, minimum 10 characters)
  • humanized: Boolean flag to enable humanization of the generated content (optional, defaults to false)



Get Content Request


Retrieve the status and results of a content generation request. Use this endpoint to poll for completion.


GET https://style.undetectable.ai/requests/{request_id}


Example Request


curl -X GET 'https://style.undetectable.ai/requests/request-uuid-here' \
--header 'x-api-key: YOUR API KEY GOES HERE'


Example Response (When Pending)


{
"id": "request-uuid-here",
"input": "What is the likelihood of lightning striking the same point more than once?",
"humanized": false,
"writingStyleId": "6afb19ba-e7f4-448d-ac2d-57a8cb47bc4b",
"status": "pending",
"output": null,
"assistantOutput": null,
"humanizedOutput": null,
"createdDate": "2025-07-09T15:31:54.591615",
"modifiedDate": "2025-07-09T15:31:54.591618"
}


Example Response (When Complete)


{
"id": "request-uuid-here",
"input": "What is the likelihood of lightning striking the same point more than once?",
"humanized": false,
"writingStyleId": "6afb19ba-e7f4-448d-ac2d-57a8cb47bc4b",
"status": "done",
"output": "Contrary to popular belief, lightning can and does strike the same location multiple times. The Empire State Building, for instance, is struck by lightning approximately 25 times per year. The myth that 'lightning never strikes twice' is scientifically unfounded. Lightning tends to strike the tallest objects in an area, and these remain consistent targets. Factors such as elevation, conductivity, and geographic features make certain locations more prone to lightning strikes, increasing the probability of repeated strikes at the same point.",
"assistantOutput": "Contrary to popular belief, lightning can and does strike the same location multiple times. The Empire State Building, for instance, is struck by lightning approximately 25 times per year. The myth that 'lightning never strikes twice' is scientifically unfounded. Lightning tends to strike the tallest objects in an area, and these remain consistent targets. Factors such as elevation, conductivity, and geographic features make certain locations more prone to lightning strikes, increasing the probability of repeated strikes at the same point.",
"humanizedOutput": null,
"createdDate": "2025-07-09T15:31:54.591615",
"modifiedDate": "2025-07-09T15:32:10.123456"
}


Response Fields


  • id: Unique identifier for the request
  • input: The original input prompt provided
  • humanized: Whether humanization was requested
  • writingStyleId: The writing style used for generation
  • status: Current status of the request (pending, done, or error)
  • output: The final output (humanized version if available, otherwise assistantOutput)
  • assistantOutput: The raw AI-generated content
  • humanizedOutput: The humanized version of the content (if humanization was requested)
  • createdDate: Timestamp when the request was created
  • modifiedDate: Timestamp when the request was last updated



Check User Credits


This endpoint retrieves the user's current credit balance for API usage.


GET https://style.undetectable.ai/check-user-credits


Example Request


curl -X GET 'https://style.undetectable.ai/check-user-credits' \
--header 'apikey: YOUR API KEY GOES HERE'


Example Response


{
"baseCredits": 10000,
"boostCredits": 1000,
"credits": 11000
}


Response Details


  • baseCredits: The user's base credit allocation
  • boostCredits: Additional bonus credits available
  • credits: Total available credits (baseCredits + boostCredits)



Usage Workflow


Basic Workflow


  1. Create Request: Send a POST request to /requests with your writing style ID and input text
  2. Poll for Completion: Use the returned request ID to poll the GET /requests/{request_id} endpoint
  3. Check Status: Continue polling until the status changes from pending to done
  4. Retrieve Results: Once complete, the output field will contain your generated content


Example Polling Implementation


import requests
import time

# Create request
response = requests.post(
'https://style.undetectable.ai/requests',
headers={
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'writingStyleId': '6afb19ba-e7f4-448d-ac2d-57a8cb47bc4b',
'input': 'What is artificial intelligence?',
'humanized': False
}
)

request_id = response.json()['id']

# Poll for completion
while True:
status_response = requests.get(
f'https://style.undetectable.ai/requests/{request_id}',
headers={'x-api-key': 'YOUR_API_KEY'}
)

result = status_response.json()

if result['status'] == 'done':
print("Generated content:", result['output'])
break
elif result['status'] == 'error':
print("Error occurred:", result)
break

time.sleep(2) # Wait 2 seconds before polling again



Errors


The API uses standard HTTP status codes and returns detailed error information when requests fail.


Common Error Codes


Error Code

Meaning

400

Bad Request -- Your request is invalid or missing required parameters.

401

Unauthorized -- Your API key is wrong.

403

Forbidden -- The API key is invalid, or there aren't sufficient credits.

404

Not Found -- The specified request ID doesn't exist or doesn't belong to your account.

422

Invalid Request Body -- Your request body is formatted incorrectly or has invalid parameters.

429

Too Many Requests -- You're sending too many requests! Slow it down!

500

Internal Server Error -- We had a problem with our server. Try again later.


Error Response Format


{
"error": "Detailed error message explaining what went wrong"
}



Best Practices


Polling Guidelines


  • Polling Interval: Poll every 2-5 seconds to balance responsiveness with server load
  • Timeout Handling: Implement a maximum polling duration (e.g., 5 minutes) to avoid infinite loops
  • Error Handling: Always check for error status and handle failures gracefully


Performance Tips


  • Batch Requests: If you need to generate multiple pieces of content, create multiple requests concurrently
  • Caching: Cache writing style IDs to avoid repeated lookups
  • Rate Limiting: Respect API rate limits to avoid throttling


Security


  • API Key Protection: Never expose your API key in client-side code or public repositories
  • Input Validation: Validate input text length and content before sending requests
  • Error Logging: Log errors for debugging while avoiding sensitive information exposure



Updated on: 09/07/2025

Was this article helpful?

Share your feedback

Cancel

Thank you!