Our Text File to Word File API enables seamless conversion of plain text files (.txt) into professionally formatted Word documents (.doc / .docx) through a simple HTTP request. Designed to be fully language-agnostic, the API can be easily integrated into any programming language, framework, or platform that supports standard HTTP communication. Whether you are building a web application, mobile app, backend service, or automated workflow, this API provides a fast, reliable, and flexible solution for transforming text files into editable Word documents that are ready for editing, sharing, printing, archiving, or further processing.
Try it in Live Tool| Feature | Us | Other APIs |
|---|---|---|
| Credit-Based Pricing | Yes | Limited or confusing |
| Transparent Billing | Yes | Surprise charges |
| Dev-Focused Docs | Yes | Sparse examples |
| Free Credits | Yes | Paywall from day 1 |
| Fast Support | Yes | 3+ day wait time |
This example will sign your document with a Nutrient certificate.

Sign up and receive 100 credits for free, or log in to automatically add your API key to sample code. If you are not sure how credits are consumed read more in our pricing documentation , or check out this guide on calculating credit usage.

Add a PDF named document. pdf to your project folder. You can use our sample document.

Copy the code and run it from the same folder you added the files to. For more information, see our language-specific getting started guides.

Open result.pdf in your project folder to view the results.
curl -X POST "https://api.skynyx.dev/v1/text_to_word" \
-H "apiKey: your_default_api_key" \
-F "text_file=@/c/Users/YourName/Downloads/sample.txt" \
-o result.jsoncurl -X POST "https://api.skynyx.dev/v1/text_to_word" ^
-H "apiKey: your_default_api_key" ^
-F "text_file=@\"C:/Users/YourName/Downloads/sample.txt\"" ^
-o result.jsonimport java.io.File;
import java.io.FileOutputStream;
import okhttp3.*;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class Program {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
File file = new File("C:/Users/YourName/Downloads/sample.txt");
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart(
"text_file",
file.getName(),
RequestBody.create(file, MediaType.parse("text/plain"))
)
.build();
Request request = new Request.Builder()
.url("https://api.skynyx.dev/v1/text_to_word")
.addHeader("apiKey", "your_default_api_key")
.post(requestBody)
.build();
Response response = client.newCall(request).execute();
String responseBody = response.body().string();
JsonObject json = JsonParser.parseString(responseBody).getAsJsonObject();
if (json.get("status").getAsInt() == 200) {
try (FileOutputStream fos = new FileOutputStream("result.json")) {
fos.write(responseBody.getBytes());
}
System.out.println("Word file URL: " + json.get("result").getAsString());
}
}
}const fs = require('fs');
const axios = require('axios');
const FormData = require('form-data');
async function main() {
const filePath = "C:/Users/YourName/Downloads/sample.txt";
const form = new FormData();
form.append('text_file', fs.createReadStream(filePath));
const response = await axios.post(
'https://api.skynyx.dev/v1/text_to_word',
form,
{
headers: {
...form.getHeaders(),
apiKey: 'your_default_api_key'
}
}
);
fs.writeFileSync('result.json', JSON.stringify(response.data, null, 2));
console.log('Word file URL:', response.data.result);
}
main();using System;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using System.Threading.Tasks;
class Program {
static async Task Main() {
var filePath = @"C:\Users\YourName\Downloads\sample.txt";
var url = "https://api.skynyx.dev/v1/text_to_word";
using var client = new HttpClient();
using var form = new MultipartFormDataContent();
var bytes = File.ReadAllBytes(filePath);
var content = new ByteArrayContent(bytes);
content.Headers.ContentType = MediaTypeHeaderValue.Parse("text/plain");
form.Add(content, "text_file", Path.GetFileName(filePath));
client.DefaultRequestHeaders.Add("apiKey", "your_default_api_key");
var response = await client.PostAsync(url, form);
var body = await response.Content.ReadAsStringAsync();
File.WriteAllText("result.json", body);
Console.WriteLine(JsonDocument.Parse(body).RootElement.GetProperty("result").GetString());
}
}import requests, json
file_path = "C:/Users/YourName/Downloads/sample.txt"
url = "https://api.skynyx.dev/v1/text_to_word"
headers = {"apiKey": "your_default_api_key"}
with open(file_path, "rb") as f:
files = {"text_file": ("sample.txt", f, "text/plain")}
response = requests.post(url, headers=headers, files=files)
json.dump(response.json(), open("result.json", "w"), indent=2)
print("Word file URL:", response.json()["result"])<?php
$file = "C:/Users/YourName/Downloads/sample.txt";
$url = "https://api.skynyx.dev/v1/text_to_word";
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["apiKey: your_default_api_key"],
CURLOPT_POSTFIELDS => [
"text_file" => new CURLFile($file, "text/plain", "sample.txt")
]
]);
$response = curl_exec($ch);
file_put_contents("result.json", $response);
echo json_decode($response)->result;
curl_close($ch);POST /v1/text_to_word HTTP/1.1
Host: api.skynyx.dev
apiKey: your_default_api_key
Content-Type: multipart/form-data; boundary=----BOUNDARY
------BOUNDARY
Content-Disposition: form-data; name="text_file"; filename="sample.txt"
Content-Type: text/plain
<text content>
------BOUNDARY--