Skip to main content
Support

Discard an article's working copy

DELETE https://api.helpdocs.io/v1/article/{article_id}/working-copy

Example request

Generated
Parameters
curl -X DELETE 'https://api.helpdocs.io/v1/article/07elszGNU1/working-copy?language_code=string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
curl -X DELETE https://api.helpdocs.io/v1/article/07elszGNU1/working-copy \
  -H 'Authorization: Bearer YOUR_TOKEN'
const url = "https://api.helpdocs.io/v1/article/07elszGNU1/working-copy?language_code=string";

const response = await fetch(url, {
  method: "DELETE",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN"
  },
});

const data = await response.json();
console.log(data);
const url = "https://api.helpdocs.io/v1/article/07elszGNU1/working-copy";

const response = await fetch(url, {
  method: "DELETE",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN"
  },
});

const data = await response.json();
console.log(data);
const url = "https://api.helpdocs.io/v1/article/07elszGNU1/working-copy?language_code=string";

const options: RequestInit = {
  method: "DELETE",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN"
  },
};

const response = await fetch(url, options);

const data: unknown = await response.json();
console.log(data);
const url = "https://api.helpdocs.io/v1/article/07elszGNU1/working-copy";

const options: RequestInit = {
  method: "DELETE",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN"
  },
};

const response = await fetch(url, options);

const data: unknown = await response.json();
console.log(data);
import requests

url = "https://api.helpdocs.io/v1/article/07elszGNU1/working-copy"

headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}

params = {
    "language_code": "string",
}

response = requests.delete(url, headers=headers, params=params)

print(response.json())
import requests

url = "https://api.helpdocs.io/v1/article/07elszGNU1/working-copy"

headers = {
    "Authorization": "Bearer YOUR_TOKEN",
}

response = requests.delete(url, headers=headers)

print(response.json())
<?php

$ch = curl_init("https://api.helpdocs.io/v1/article/07elszGNU1/working-copy?language_code=string");

curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "DELETE",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer YOUR_TOKEN",
    ],
]);

$response = curl_exec($ch);

print_r(json_decode($response, true));
<?php

$ch = curl_init("https://api.helpdocs.io/v1/article/07elszGNU1/working-copy");

curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "DELETE",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer YOUR_TOKEN",
    ],
]);

$response = curl_exec($ch);

print_r(json_decode($response, true));
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, err := http.NewRequest(http.MethodDelete, "https://api.helpdocs.io/v1/article/07elszGNU1/working-copy?language_code=string", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer YOUR_TOKEN")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	data, err := io.ReadAll(res.Body)
	if err != nil {
		panic(err)
	}
	fmt.Println(string(data))
}
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, err := http.NewRequest(http.MethodDelete, "https://api.helpdocs.io/v1/article/07elszGNU1/working-copy", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer YOUR_TOKEN")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	data, err := io.ReadAll(res.Body)
	if err != nil {
		panic(err)
	}
	fmt.Println(string(data))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newHttpClient();

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.helpdocs.io/v1/article/07elszGNU1/working-copy?language_code=string"))
            .header("Authorization", "Bearer YOUR_TOKEN")
            .DELETE()
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println(response.body());
    }
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newHttpClient();

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.helpdocs.io/v1/article/07elszGNU1/working-copy"))
            .header("Authorization", "Bearer YOUR_TOKEN")
            .DELETE()
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println(response.body());
    }
}
require "json"
require "net/http"

uri = URI("https://api.helpdocs.io/v1/article/07elszGNU1/working-copy?language_code=string")

request = Net::HTTP::Delete.new(uri)
request["Authorization"] = "Bearer YOUR_TOKEN"

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(request)
end

pp JSON.parse(response.body)
require "json"
require "net/http"

uri = URI("https://api.helpdocs.io/v1/article/07elszGNU1/working-copy")

request = Net::HTTP::Delete.new(uri)
request["Authorization"] = "Bearer YOUR_TOKEN"

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(request)
end

pp JSON.parse(response.body)
var client = new HttpClient();

var request = new HttpRequestMessage(HttpMethod.Delete, "https://api.helpdocs.io/v1/article/07elszGNU1/working-copy?language_code=string");
request.Headers.Add("Authorization", "Bearer YOUR_TOKEN");

var response = await client.SendAsync(request);

Console.WriteLine(await response.Content.ReadAsStringAsync());
var client = new HttpClient();

var request = new HttpRequestMessage(HttpMethod.Delete, "https://api.helpdocs.io/v1/article/07elszGNU1/working-copy");
request.Headers.Add("Authorization", "Bearer YOUR_TOKEN");

var response = await client.SendAsync(request);

Console.WriteLine(await response.Content.ReadAsStringAsync());

Responses

{
  "article": {
    "article_id": "string",
    "account_id": "string",
    "user_id": "string",
    "category_id": "string",
    "author": {
      "name": "string",
      "email": "string",
      "profile_image": "string"
    },
    "title": "string",
    "description": "string",
    "short_version": "string",
    "body": "string",
    "slug": "string",
    "icon": "string",
    "tags": [
      "string"
    ],
    "show_toc": true,
    "is_private": true,
    "is_published": true,
    "is_archived": true,
    "status": "string",
    "archived_at": "2024-01-15T09:30:00Z",
    "archived_by": "string",
    "archive_reason": "string",
    "is_featured": true,
    "related_article_ids": [
      "string"
    ],
    "related_auto": true,
    "is_current_version": true,
    "version_number": 1,
    "source": "string",
    "external_id": "string",
    "editor_type": "string",
    "stale_status": {
      "is_stale": true,
      "reason": "string",
      "source": "string",
      "triggered_at": "2024-01-15T09:30:00Z",
      "expires_at": "2024-01-15T09:30:00Z"
    },
    "created_at": "2024-01-15T09:30:00Z",
    "updated_at": "2024-01-15T09:30:00Z",
    "permission_groups": [
      "string"
    ],
    "multilingual": [
      {
        "language_code": "string",
        "title": "string",
        "description": "string",
        "short_version": "string",
        "body": "string",
        "slug": "string",
        "tags": [
          "string"
        ],
        "user_id": "string",
        "url": "string",
        "relative_url": "string",
        "is_live": true,
        "is_current_version": true,
        "version_number": 1,
        "editor_type": "string",
        "machine_translated_at": "2024-01-15T09:30:00Z",
        "has_working_copy": true,
        "created_at": "2024-01-15T09:30:00Z",
        "content_token": "string"
      }
    ],
    "url": "string",
    "relative_url": "string",
    "description_was_autogenerated": true,
    "short_version_was_autogenerated": true
  }
}

The article as it now reads

Schemas
string

The If-Match header is malformed, names another article, carries two different tokens for one language, or has no tag for the language being discarded.

Schemas
{
  "code": 1,
  "err": "string"
}

Authentication failed or no API key was supplied.

Schemas
{
  "code": 1,
  "err": "string"
}

The account’s billing is past due and writes are locked. Reads keep working; editing resumes once billing is settled.

Schemas
{
  "code": 1,
  "err": "string"
}

The key lacks write permission, or the account’s plan does not include API access.

Schemas
string

No such resource in this account, or article_id does not match the pattern this route accepts.

Schemas
string

The article is archived, a pending version is in review, the language has never been published, or (with If-Match) the language has been saved since the token was issued.

Schemas
{
  "code": 1,
  "err": "string"
}

Rate limited. Wait the number of seconds in Retry-After before trying again. X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset say which allowance was spent and when it refills.

Schemas
Generated

Throws away the unpublished edits waiting on top of the article’s live version, in one language. What readers see does not change: the next read of the working copy is the live version again. Working copies are per-language, so this discards one language per call.

Anyone who may edit the article may discard a working copy made only of their own saves. Discarding edits anyone else saved needs an editor (or an API key), because the discarded versions are deleted for good.

Returns 400 for an If-Match that cannot guard this discard, 403 when the working copy holds someone else’s edits and the caller is not an editor, 404 when the language has no working copy, and 409 when the article is archived, a pending version is in review, or the language has never been published (discarding would delete the whole translation).

To discard only what you have seen, send If-Match with the ETag of a working_copy=true read in the same language. If anyone has saved that language since, nothing is discarded and you get 409: read the working copy again, then decide. Without If-Match the discard is unguarded.

Authentication

    • ApiKeyBearer http bearer

      An API key sent as Authorization: Bearer <key>. A key holds scopes, the same ones OAuth uses, and an operation needs the scope listed for it under OAuth2. A key may also expire, or be revoked or rotated in Settings > API, after which it is refused with a 401.

    • OAuth2 oauth2

      An OAuth 2.0 access token for an app acting on behalf of a HelpDocs user, sent as Authorization: Bearer <token>. The authorization code flow requires PKCE (S256). Each operation names the one scope it needs.

      Scopes write:articles

Path parameters

  • article_id string Required

    pattern ^[0-9a-zA-Z]{10}$

Query parameters

  • language_code string

    Discard the working copy of this translation. Defaults to the account’s default language.

Header parameters

  • If-Match string

    The entity-tag “::” of a working_copy=true read, as its ETag header gives it. The discard goes ahead only if nobody has saved that language since. A tag for another article, two different tokens for one language, or a header with no tag for the language being discarded is refused with 400.

Responses

200

The article as it now reads

application/json ArticleResponse
  • article Article Required Nullable
400

The If-Match header is malformed, names another article, carries two different tokens for one language, or has no tag for the language being discarded.

text/plain

The failure, as a human-readable message.

  • string

    The failure, as a human-readable message.

401

Authentication failed or no API key was supplied.

application/json Error

An error response.

  • code integer Required

    The HTTP status code.

  • err string Required

    A human-readable description of the failure.

402

The account’s billing is past due and writes are locked. Reads keep working; editing resumes once billing is settled.

application/json Error

An error response.

  • code integer Required

    The HTTP status code.

  • err string Required

    A human-readable description of the failure.

403

The key lacks write permission, or the account’s plan does not include API access.

application/json Error

An error response.

  • code integer Required

    The HTTP status code.

  • err string Required

    A human-readable description of the failure.

404

No such resource in this account, or article_id does not match the pattern this route accepts.

text/plain

The failure, as a human-readable message.

  • string

    The failure, as a human-readable message.

409

The article is archived, a pending version is in review, the language has never been published, or (with If-Match) the language has been saved since the token was issued.

text/plain

The failure, as a human-readable message.

  • string

    The failure, as a human-readable message.

429

Rate limited. Wait the number of seconds in Retry-After before trying again. X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset say which allowance was spent and when it refills.

headers

  • Retry-After integer
  • X-RateLimit-Limit integer
  • X-RateLimit-Remaining integer
  • X-RateLimit-Reset integer
application/json Error

An error response.

  • code integer Required

    The HTTP status code.

  • err string Required

    A human-readable description of the failure.

All endpoints