Setting metadata or flags on JIRA file attachments using Python API

I’m working on a project where I need to track which JIRA attachments have been processed or downloaded already. The goal is to distinguish between files that were already handled and new ones that get added later.

I’m wondering if there’s a way to add some kind of flag or metadata to existing attachments through the JIRA Python API. Maybe there’s a property I can set or update on the attachment object itself?

If direct metadata isn’t possible, are there any alternative approaches to achieve this? I need to stick with the Python API for JIRA integration.

Has anyone dealt with a similar requirement before? Any suggestions would be helpful.

Unfortunately, you can’t modify JIRA attachment objects after they’re created - they’re immutable in the Python API. I ran into this same issue while building an automated report system that processed JIRA attachments. My workaround was simple: create a JSON file that updates every time the script runs. I store attachment IDs with timestamps and processing flags. Works great since attachment IDs never change. The JSON file acts like a lightweight cache that sticks around between runs. Another option is using JIRA’s issue properties feature to store processed attachment metadata at the issue level, but you’ll need to manage the data structure carefully if you have multiple attachments per issue.

yeah, you can’t pull attachment metadata directly. i usually stick with using jira labels on issues. also, adding processed attachment ids to a custom field or following a naming convention when saving files can help keep things organized without stressing the db too much.

JIRA’s attachment objects don’t support custom metadata or flags through the Python API. The attachment properties are basically read-only once you create them. I faced a similar issue while building a document processing system. To address this, I maintained a separate tracking table in my app database that stored attachment IDs along with their processing status. Each time I queried JIRA for attachments, I cross-referenced this table to identify which ones had already been handled. Another effective approach is to utilize issue comments formatted with specific labels to log the processing status. You can programmatically add comments through the API and later parse them to review processing history. While not the cleanest solution, it keeps everything within JIRA, which may be important for your workflow.