Appstore Connect API Territory Availabilities Resource error

I have been trying to do a post request on this appstore api endpoint to be able to set availability on USA territory. However even after following the payload body I still get the error of no matching resource was included.

Here is my payload:

payload = {
        data: {
            attributes: {
                availableInNewTerritories: true
            },
            relationships:{
                app:{
                    data: { type: "apps", id: app_id }
                },
                territoryAvailabilities: {
                    data: [{
                        id: "#{territory_id}",
                        type: "territoryAvailabilities"
                    }]
                }
            },
            type: "appAvailabilities"
        },
        included: [{
            id: "#{territory_id}",
            type: "territoryAvailabilities"
        }]
    }

and this is the api error response I get:

{
  "errors" : [ {
    "id" : "2c42b5cc-4.....",
    "status" : "409",
    "code" : "ENTITY_ERROR.RELATIONSHIP.INVALID",
    "title" : "The provided entity includes a relationship with an invalid value",
    "detail" : "The relationship 'territoryAvailabilities' expects an included resource with type 'territoryAvailabilities' and id 'USA' but no matching resource was included.",
    "source" : {
      "pointer" : "/included"
    }
  } ]
}

I am confused as to what the error was referring to as I added the included payload as array and the ids and type match with the territoryAvailabilities relationships as well.

What does your #{territory_id} expand to?

Appstore Connect API Territory Availabilities Resource error
 
 
Q