Migrate · Freshdesk · Export

Export every Freshdesk ticket and reply, archived ones too, with a 107-line script

Three ways to get tickets out of Freshdesk, what each one keeps, and the counts that show nothing is missing before you cancel.

The 107-line script in section 3 exports every Freshdesk ticket with its replies, notes and attachments through the API, archived tickets included, and ends with counts you check against Freshdesk's own total. Freshdesk's All tickets export (CSV or Excel) has the ticket fields only: no replies, notes or archived tickets.

What you get Ticket list export (CSV/Excel) Account export (XML) API script on this page
Ticket fields (subject, status, priority, dates) Yes, fields you choose Yes Yes
Replies and private notes No Yes Yes, every page of each ticket's conversations
Archived tickets Not in the All tickets export; the Archive view has its own export Yes Yes, looked up by id
Attachments Not offered in Freshdesk's export article Not covered in Freshdesk's export articles Downloaded into attachments/
Customers Separate contact and company exports The customer list No
Counts you can check No No Yes, printed at the end
Who can run it Admin or Supervisor whose role has export permission The Account Administrator Anyone whose API key can view the tickets

Moving to a new helpdesk, not keeping a backup? Skip to Moving to Colliedesk: its importer reads the same API for you.

1. Ticket list export: fields only

Use this when you need a spreadsheet, not a backup.

  1. Open Tickets and select the All tickets view.
  2. On the list page, set Created time to Any time.
  3. Select Export in the top-right corner.
  4. Choose CSV or Excel, and the date range.
  5. Select the ticket fields. To include Description, expand Show multiline text fields.
  6. Download the file from Admin > Accounts exports when it is ready.

The export covers only tickets inside the list page's time frame, so set the list to Any time first and pick the range in the export window.

2. Account export: the full backup in XML

  1. Sign in as the Account Administrator.
  2. Go to Admin > Account > Account Details.
  3. Under Export data, click Export.
  4. Wait for the email, or download the file from Admin > Accounts exports. Freshdesk says the export can take up to 10 business days, so start it well before you cancel.
  5. Open a few tickets in the XML and compare them with Freshdesk.

The file holds your tickets, solutions, forums and customer list. Freshdesk suggests you have a developer convert the XML into a readable format. To move to a new helpdesk you still need an importer.

3. API script: every ticket, reply and file, with counts

You need someone who can run a shell script; if that is not you, send them this section. The script reads tickets, every page of their replies and notes, archived tickets and attachments, and writes them to files in the folder you run it from.

  1. Get your API key. In Freshdesk, click your profile picture and open Profile settings. The key is below the change password section.

  2. Save the script below as freshdesk-export.sh in the folder where you run the commands in step 3. It needs bash, curl and jq.

  3. Run it from an empty folder. It asks for the key without showing it, so the key never goes on the command line or into your shell history:

    export FRESHDESK_DOMAIN=yourcompany.freshdesk.com
    mkdir freshdesk-export && cd freshdesk-export
    bash ../freshdesk-export.sh
    
  4. Keep what it writes: tickets.ndjson and conversations.ndjson (one JSON object per line), attachments/, the ids-*.txt files and attachment-errors.txt.

We ran it against a local stand-in for the Freshdesk API that follows Freshdesk's API docs, not against a live Freshdesk account, so check the counts before you cancel (see below).

Show the script (107 lines of bash)
set -euo pipefail
umask 077
API="https://$FRESHDESK_DOMAIN/api/v2"
PAGES_PER_WINDOW=300 # Freshdesk returns at most 300 pages for one ticket list query
PROBE_AHEAD=200 # stop after this many ids in a row past the highest listed one do not exist
[ -z "$(find . -mindepth 1 ! -name '*.sh' ! -name .DS_Store)" ] || { echo "Run the script in an empty folder; this one has files." >&2; exit 1; }
# The key comes from the environment or a hidden prompt, never from the command line.
printenv FRESHDESK_API_KEY > /dev/null || { read -rsp 'Freshdesk API key: ' FRESHDESK_API_KEY; echo; }
printf 'user = "%s:X"\n' "$FRESHDESK_API_KEY" > auth.conf
trap 'rm -f auth.conf body.json headers.txt files.tsv listed.txt' EXIT
mkdir attachments
touch ids-live.txt ids-archived.txt ids-spam.txt ids-deleted.txt ids-absent.txt attachment-errors.txt

# GET one API URL into body.json and print the HTTP status. Waits on 429, retries a 5xx 4 times.
get() {
  local code tries=0 wait
  while :; do
    code=$(curl -sSg --connect-timeout 30 --max-time 600 -K auth.conf -o body.json -D headers.txt -w '%{http_code}' "$1") || code=000
    if [ "$code" = 429 ]; then
      wait=$(awk -F': ' 'tolower($1)=="retry-after" {print $2+0}' headers.txt)
      [ -n "$wait" ] || wait=60
      sleep "$wait"; continue
    fi
    case $code in 5??|000) tries=$((tries + 1)); [ "$tries" -gt 4 ] || { sleep "$tries"; continue; } ;; esac
    echo "$code"; return
  done
}
next_link() { awk 'tolower($0) ~ /^link:.*rel="?next/ {match($0, /<[^>]*>/); u = substr($0, RSTART + 1, RLENGTH - 2); gsub(/ /, "", u); print u}' headers.txt; }
need() { [ "$1" = 200 ] || { echo "HTTP $1 on $2" >&2; exit 1; }; }

# 1. List every ticket id outside the archive, oldest update first. One query stops after 300
#    pages, so the next one starts 1 second before the last update seen.
since=1970-01-01T00:00:00Z
: > listed.txt
while :; do
  url="$API/tickets?updated_since=$since&order_by=updated_at&order_type=asc&per_page=100"
  pages=0 last=$since
  while [ -n "$url" ] && [ "$pages" -lt "$PAGES_PER_WINDOW" ]; do
    need "$(get "$url")" "the ticket list"
    jq -r '.[].id' body.json >> listed.txt
    last=$(jq -r --arg l "$last" '[.[].updated_at, $l] | max' body.json)
    url=$(next_link) pages=$((pages + 1))
  done
  [ -n "$url" ] || break
  next=$(jq -rn --arg l "$last" '$l | fromdateiso8601 - 1 | todate')
  [[ "$next" > "$since" ]] || { echo "too many tickets share one update time" >&2; exit 1; }
  since=$next
done
sort -nu listed.txt -o listed.txt

# 2. Freshdesk's own count of the tickets outside the archive.
code=$(get "$API/search/tickets?query=%22created_at:%3E%272000-01-01%27%22")
total=$([ "$code" = 200 ] && jq -r .total body.json || echo "unavailable (HTTP $code)")

# 3. Look up every id: live, archived, spam, deleted or absent. Past the highest listed id, go on
#    until 200 ids in a row do not exist: an old account may hold only archived tickets.
archive=yes misses=0 gap="" id=0
max=$(tail -n 1 listed.txt | grep . || echo 0)
exec 3< listed.txt
read -r listed <&3 || listed=0
while [ "$id" -lt "$max" ] || [ "$misses" -lt "$PROBE_AHEAD" ]; do
  id=$((id + 1)) kind=absent path=tickets order="archived live"
  # A listed ticket is tried as live first; Freshdesk may archive it while the script runs.
  if [ "$id" = "$listed" ]; then read -r listed <&3 || listed=0; order="live archived"; fi
  for try in $order; do
    if [ "$try" = live ]; then
      code=$(get "$API/tickets/$id")
      [ "$code" = 404 ] || { need "$code" "ticket $id"; kind=$(jq -r 'if .spam then "spam" elif .deleted then "deleted" else "live" end' body.json); break; }
    elif [ "$archive" = yes ]; then
      code=$(get "$API/tickets/archived/$id")
      case $code in 200) kind=archived path=tickets/archived; break ;; 403) archive=refused ;; 404) ;; *) need "$code" "archived ticket $id" ;; esac
    fi
  done
  if [ "$kind" = absent ]; then gap="$gap $id" misses=$((misses + 1)); continue; fi
  for g in $gap; do echo "$g" >> ids-absent.txt; done
  gap="" misses=0
  echo "$id" >> "ids-$kind.txt"
  case $kind in live|archived) ;; *) continue ;; esac

  # 4. The ticket, every page of its conversations, then its files while the links are fresh.
  jq -c --arg k "$kind" '. + {export_kind: $k}' body.json >> tickets.ndjson.partial
  jq -r '.attachments[]? | [.id, (.size // .file_size // -1), (.name // "" | if . == "" then "unnamed" else . end), .attachment_url] | @tsv' body.json > files.tsv
  url="$API/$path/$id/conversations?per_page=100"
  while [ -n "$url" ]; do
    need "$(get "$url")" "conversations of ticket $id"
    jq -c '.[]' body.json >> conversations.ndjson.partial
    jq -r '.[].attachments[]? | [.id, (.size // .file_size // -1), (.name // "" | if . == "" then "unnamed" else . end), .attachment_url] | @tsv' body.json >> files.tsv
    url=$(next_link)
  done
  while IFS=$'\t' read -r fid size name furl; do
    file="attachments/$fid-$(printf '%s' "$name" | tr -c 'A-Za-z0-9._-' _)"
    if ! curl -sSfLg --connect-timeout 30 --max-time 600 -o "$file" "$furl"; then echo "$fid download failed (ticket $id)" >> attachment-errors.txt
    elif [ "$(wc -c < "$file" | tr -d ' ')" != "$size" ]; then echo "$fid size differs from $size (ticket $id)" >> attachment-errors.txt; fi
  done < files.tsv
done
touch tickets.ndjson.partial conversations.ndjson.partial
mv tickets.ndjson.partial tickets.ndjson
mv conversations.ndjson.partial conversations.ndjson

n() { wc -l < "$1" | tr -d ' '; }
[ "$archive" = yes ] || echo "Archived tickets: not checked, Freshdesk refused /tickets/archived (HTTP 403)"
echo "Freshdesk filter total (archived not counted): $total"
echo "Tickets exported: $(n ids-live.txt) live, $(n ids-archived.txt) archived"
echo "Not exported: $(n ids-spam.txt) spam, $(n ids-deleted.txt) deleted, $(n ids-absent.txt) ids with no ticket"
echo "Conversations exported: $(n conversations.ndjson)"
echo "Attachments: $(find attachments -type f | wc -l | tr -d ' ') files," \
  "$(find attachments -type f -exec cat {} + | wc -c | tr -d ' ') bytes; size or download problems: $(n attachment-errors.txt)"

Traps in the Freshdesk API docs, and what the script does

  • 30 days by default. Listing tickets returns only those created in the last 30 days unless you pass updated_since. The script starts at 1970.
  • 300 pages per query. One list query returns at most 300 pages (30,000 tickets at 100 a page). The script starts a new query 1 second before the last update it saw and skips ids it already has.
  • Spam and deleted tickets are left out of the list. For archived tickets, the API docs give no endpoint that lists them; the API reads one at a time by id. So the script tries every id the list did not return, first as an archived ticket, then as a normal one. A listed id that is gone by the time the script reads it is tried in the archive too, since Freshdesk may archive it during the run. Past the highest listed id, the script goes on until 200 ids in a row do not exist, so an account where every ticket is archived still exports. If 200 or more ids in a row past the newest ticket were deleted for good, the script stops early; the Archive view check below catches that. Each id lands in ids-live.txt, ids-archived.txt, ids-spam.txt, ids-deleted.txt or ids-absent.txt.
  • Archive refused. If Freshdesk answers 403 on the archive endpoint, the script stops trying it, says so in its last lines and reads the rest. Archived tickets then count as ids with no ticket.
  • 10 conversations. include=conversations returns at most 10. The script calls /conversations for each ticket and follows every page.
  • Attachment links. The docs do not say how long a link works, so the script downloads each file right after its ticket. It sends no API key with the downloads. A failed download, or a file whose size differs from what Freshdesk reported, goes into attachment-errors.txt. The script downloads only the files in each ticket's and reply's attachments list. It does not download images pasted inside a message; the HTML body keeps whatever link Freshdesk put there.
  • Rate limits are per minute (accounts Freshdesk has not moved to per-minute limits have hourly ones), by plan, for the whole account, with lower limits for some calls: on Growth, 100 calls a minute, with a separate 40 a minute for the ticket list. Freshdesk says ticket list and view calls have such a separate limit, and nearly every call the script makes starts with /tickets. Trial accounts get 50 a minute. The script makes at least two calls per ticket. On a 429 it waits for the Retry-After seconds, so a large account takes hours and uses the calls your other integrations share.

The script retries a 5xx error 4 times and stops at any other error. It writes tickets and conversations to .partial files that are renamed only at the end, so a stopped run never looks complete. It refuses a folder that already holds files other than the script, so a second run never mixes with the first.

Counts to check before you cancel

The script ends with five lines (six if the archive was refused):

Line What it counts Check it against
Freshdesk filter total Freshdesk's own count of tickets outside the archive, from the Filter Tickets API The live number on the next line
Tickets exported live: tickets read from /tickets. archived: tickets read from /tickets/archived The export of the Archive view in the Tickets tab, for archived
Not exported Spam, deleted, and ids with no ticket A few ids from each ids-*.txt file, opened in Freshdesk
Conversations exported Replies and notes, across all tickets The thread of 3 long tickets in Freshdesk
Attachments Files and bytes downloaded, and the problems attachment-errors.txt, which should be empty
  1. Compare live with the filter total. Freshdesk says the filter leaves out archived tickets, and that a change takes a few minutes to show in it. Run the script when nobody is working, or compare again a few minutes later.

  2. If live is lower, look in ids-spam.txt and ids-deleted.txt first. Freshdesk's docs do not say whether the filter total counts those tickets.

  3. Check archived tickets. Freshdesk archives a closed ticket after 120 days with no activity. In the Tickets tab, select the Archive view, apply no filters and export it, then compare its rows with ids-archived.txt.

  4. Check long threads. Pick 3 tickets with many replies, count the replies and notes in Freshdesk, and compare:

    jq -c 'select(.ticket_id == 1234)' conversations.ndjson | wc -l
    
  5. Run the script again in a new empty folder if attachment-errors.txt is not empty, then check that file again.

  6. Cancel only after the counts match. Freshdesk deletes the account and its data 14 days after the subscription ends.

Moving to Colliedesk

Colliedesk's importer reads the same API for you, from Settings > Data > Import from Freshdesk in the app or the collie import freshdesk command. It copies tickets with every reply and note, archived tickets where your Freshdesk plan allows the archive API, attachments with a SHA-256 checksum, tags, contacts, companies and time entries. It ends with a reconcile report: if one count does not match, the report says FAILED and lists the Freshdesk ids. The import guide has the steps.

Start the free trial and run the import into it; on Colliedesk Cloud the first import extends a trial to 30 days. Compare plans on Colliedesk pricing, or read how the done-for-you Freshdesk migration works. The full exit plan is in Migrate from Freshdesk. Still choosing a helpdesk? Read Freshdesk alternatives. Leaving another helpdesk too? Read Export your tickets from Zendesk or Export conversations from Help Scout, or compare all three in helpdesk migration: what each export leaves out.

Sources

All read 30 November 2026.

Questions people ask

How do I export all tickets from Freshdesk?

For ticket fields only, use Export on the All tickets view (CSV or Excel). For the replies, notes and archived tickets too, run the account export from Admin > Account > Account Details, or the API script on this page, which also prints counts to check.

Does the Freshdesk ticket export include the conversation?

No. Freshdesk says the ticket list export does not give you the entire conversation or archived tickets. The account export and the API do.

Does the Freshdesk API export include archived tickets?

Freshdesk archives a closed ticket after 120 days with no activity. The API docs give no endpoint that lists archived tickets; the API reads one only by its id, from /api/v2/tickets/archived/[id]. The script on this page tries every id the list did not return, and goes on past the highest one.

How long do Freshdesk attachment links last?

Freshdesk's API docs do not say. Download each file soon after you read its ticket, as the script does, and check attachment-errors.txt for any file that failed.

Can I export Freshdesk tickets on the free plan?

The ticket list export needs an Admin or Supervisor role whose export permission is on. For the API, Freshdesk's rate-limit table lists Growth, Pro and Enterprise, not Free. Check your plan and role in Freshdesk, and finish the export before the plan or account ends.