JSON Payload for POST Request

Starting with JSON body because this is the way that most API documentation will give you the payload examples.

body = '{
    "filters": {
        "keywords": ["money","government"],
        "award_type_codes": [
            "A",
            "B",
            "C",
            "D"
        ]
    },
    "fields": [
        "Award ID",
        "Mod",
        "Recipient Name",
        "Action Date",
        "Transaction Amount",
        "Awarding Agency",
        "Awarding Sub Agency",
        "Award Type"
    ],
    "page": 1,
    "limit": 35,
    "sort": "Transaction Amount",
    "order": "desc"
}'
library(httr)

Send the body as a JSON string.

POST("https://api.usaspending.gov//api/v2/search/spending_by_transaction/", content_type_json(), body = body)

Send the body as a JSON encoded list.

POST("https://api.usaspending.gov//api/v2/search/spending_by_transaction/", body = body_list, encode = "json")