It kinda depends on your approach you want to go.
The rails console approach is fairly complicated because of the structure and how translations in the knowledge base work.
The easiest approach actually is the API. Please note that this only applies to attachments.
Inline images do not count as attachment. (in case you’ve wondered). (I’m limitting the output but am providing the relevant parts below)
The following endpoint allows you to get all information on answers and their attachments:
/api/v1/knowledge_bases/{ knowledge-base-id }/answers/{ answer-id }
(Replace the ID place holders with your fitting content).
This would be an example output.
{
"id": 1,
"assets": {
"KnowledgeBaseAnswer": {
"1": {
"id": 1,
"category_id": 4,
"position": 0,
"internal_at": null,
"published_at": "2021-11-09T13:15:43.237Z",
"archived_at": null,
"promoted": false,
"internal_note": null,
"archived_by_id": null,
"internal_by_id": null,
"published_by_id": 3,
"created_at": "2021-11-09T13:15:43.237Z",
"updated_at": "2021-12-24T13:04:09.779Z",
"translation_ids": [
2,
1
],
"attachments": [
{
"id": 47,
"url": "/api/v1/attachments/47",
"preview_url": "/api/v1/attachments/47?preview=1",
"filename": "21-12-01 14-05-55 5067.png",
"size": "1847141",
"preferences": {
"Content-Type": "image/png",
"resizable": true,
"content_preview": true
}
},
{
"id": 48,
"url": "/api/v1/attachments/48",
"preview_url": "/api/v1/attachments/48?preview=1",
"filename": "21-12-02 12-15-23 5068.jpg",
"size": "116875",
"preferences": {
"Content-Type": "image/jpeg",
"resizable": true,
"content_preview": true
}
},
{
"id": 49,
"url": "/api/v1/attachments/49",
"preview_url": "/api/v1/attachments/49?preview=1",
"filename": "21-12-04 19-31-18 5069.jpg",
"size": "149169",
"preferences": {
"Content-Type": "image/jpeg",
"resizable": true,
"content_preview": true
}
}
],
"tags": []
},
"3": {
"id": 3,
"category_id": 4,
"promoted": false,
"internal_note": null,
"position": 1,
"archived_at": null,
"archived_by_id": null,
"internal_at": null,
"internal_by_id": null,
"published_at": "2021-11-09T13:15:43.556Z",
"published_by_id": 3,
"created_at": "2021-11-09T13:15:43.556Z",
"updated_at": "2021-11-09T13:15:43.858Z",
"translation_ids": [
6,
5
],
"attachments": [],
"tags": []
},
...
}
Retreiving actual translation content is a bit… different. If you add ?include_contents=1
to above endpoint URL you’ll receive the complete answer - including content. This may be fairly big if you have inline content. (Inline content means: Images and GIFs)
You’re then looking for this payload part:
...
"KnowledgeBaseAnswerTranslationContent": {
"1": {
"body": "The flat white is simply the perfect start for your day. It perfectly fits breakfast and is done super easy and fast.<div><br></div><img src=\"data:image/gif;base64,R0lGODlhcQUAA3gAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQEEQAAACwAAAAAcQUAA6f+/vX+/fP+/v3+/v78/v7+/v7+/v79/f78/f39/f38/Pz8/Pz5+vz4+vv4+fr4+fr4+fr4+fn5+fn5+Pj4+Pf39/b29/f09/jw+Pnt+vvp+vvk+vvi+fnf9/rT+PvO9PvV9Prs8vTx8vPy8vPy8vLx8fLx8fHw8fHw8PDv7+/u7u7t7u7s7u/q7vDq7vDp7vDp7vDp7O7o6+zl5evh5unk5efl5eXk5OTe4OHZ3+Lb3t7b2Nrn1db12M/42c342s342sz42sz528v428v33Mn228r228v33M333c723tH13db43Nv33N344t/55+H56uL48er59uz4+O35+ef4+OX59+L599359tb499P49c747sr46cT35bz14bbw2bbv1LXuz7L0zq7zzaj1zZ31ypfvxZnmw6Hiv6XgvaHguZrjs4birnvasIXRsJbPrZXLqJnIqZzBqZu6rJ+uramprq2sr7CxsbKysrSysrOysrO2s7S0tLW2tre2t7m5uru9vb6/wcLDxMbFyMnFzM/AztS9zdO6zNK7y9K6ytK5xte4vde8udfCt9bJttbQu9fSxtbRz9TO0tfJ1t7C3OzA4fa85vq15Pqy4Piv1/Wq0vWm0PiizvOXzvWPy/Z+xvNzv+2GvOWXuuCWs9ibptGMqc59pNFin9tQntpCmNU1nNohoN4SpeESmtsjj88/eblEcrBHbadacpRzeoN9fn6JgXyJiIaLj5GKkJKLkpSMkpeNlJqTlZeYl5eamJeampqZm52Tm6OKma+KnLmMnr2Tm7ubmbKgn6mknqOmlqCplZiynJe2npW5npfFmojRknXVjGnQimDPiFnSgkvZdj/ieDfjdTTgbzPeajLcZzPbZDHaYi/XYDTWXTDTXC/SWjLRWTjNWDDJVzHIVjTKVTfJVTvFVDvCVDm9Uzi9VTy4XkKtaUqcXUuOVE2DUlB4X1tuaGdsbm9ma21hZ2xZYGhXX2RXYGNZX2FZW1tUWV1MVGpETHdDS19NSk9DSk5BQkYwNDcI/
...",
"id": 1,
"attachments": []
}
}
}
}
There currently technically is only one knowledge base possible so there’s no endpoint for getting the kb id - usually this ID would be 1
. Opening any knowledge base answer within the agent / admin view tells you - it’s the first ID

You can list all* available answers like so:
/api/v1/knowledge_bases/{ knowledge-base-id }
{
"id": 1,
"iconset": "FontAwesome",
"color_highlight": "#38ae6a",
"color_header": "#f9fafb",
"color_header_link": "#555",
"homepage_layout": "grid",
"category_layout": "grid",
"active": true,
"custom_address": null,
"created_at": "2021-11-09T03:15:42.899Z",
"updated_at": "2021-12-13T08:45:30.412Z",
"translation_ids": [
2,
1
],
"kb_locale_ids": [
1,
2
],
"category_ids": [
5,
7,
2,
3,
9,
6,
10,
11,
4,
1,
8
],
"answer_ids": [
2,
8,
9,
10,
7,
13,
14,
6,
5,
4,
3,
1,
12,
11
]
}
Hopefully this helps on your journey.