Discrepancies between Company API and Document API for Barcodes

When running the filing history end point in the beta API, we have noticed a difference to the Document API with regards to the barcode for some documents.

Running GET /company/03763138/filing-history?category=accounts returns data, including the following snippet -

{
      "description": "accounts-with-accounts-type-small",
      "type": "AA",
      "date": "2002-03-14",
      "action_date": "2001-02-28",
      "category": "accounts",
      "description_values": {
        "made_up_date": "2001-02-28"
      },
      "links": {
        "document_metadata": "https://frontend-doc-api.companieshouse.gov.uk/document/ZTHA9rUqzXmH_cnINKK_obhzQ28ap25LNdF2Mn2_vIk",
        "self": "/company/03763138/filing-history/MDExMDYyMDQ1M2FkaXF6a2N4"
      },
      "pages": 9,
      "paper_filed": true,
      "barcode": null,
      "transaction_id": "MDExMDYyMDQ1M2FkaXF6a2N4"
    }

As you can see, the barcode is null. However, when running the document API for the metadata link https://document-api.companieshouse.gov.uk/document/ZTHA9rUqzXmH_cnINKK_obhzQ28ap25LNdF2Mn2_vIk it returns the following -

{
    "company_number": "03763138",
    "barcode": "A5Y7V91P",
    "significant_date": "2001-02-28T00:00:00Z",
    "significant_date_type": "",
    "category": "accounts",
    "pages": 9,
    "created_at": "2015-01-31T20:56:20.959078544Z",
    "etag": "",
    "links": {
        "self": "https://document-api.companieshouse.gov.uk/document/ZTHA9rUqzXmH_cnINKK_obhzQ28ap25LNdF2Mn2_vIk",
        "document": "https://document-api.companieshouse.gov.uk/document/ZTHA9rUqzXmH_cnINKK_obhzQ28ap25LNdF2Mn2_vIk/content"
    },
    "resources": {
        "application/pdf": {
            "content_length": 166000
        }
    }
}

As you can see, the barcode is populated.

As it stands we have to check the content of the first call and, if the barcode is null, run a second call to the document API in order to get the barcode value. This adds overhead on both sides and would seem to be a bug in the filing history end point.

Can someone confirm if this is a bug? If it isn’t, why do the different APIs report different data?

I suspect the barcode should not be there, but I have reported this for investigation.