USAspending.gov API Code Generator
USAspending.gov API Code Generator · GPT 작업
USAspending API
API endpoints for PSC Autocomplete and Funding Agency Autocomplete.
POST /api/v2/autocomplete/psc/PSC AutocompleteRetrieves product or service (PSC) codes and their descriptions based on a search string.
POST /api/v2/autocomplete/funding_agency/Funding Agency AutocompleteRetrieves funding agencies matching the specified search text.
GET /api/v2/recipient/{recipient_id}/Specific Recipient IdentifierReturns a high-level overview of a specific recipient, given its ID.
원본 API 스키마
{
"openapi": "3.0.0",
"info": {
"title": "USAspending API",
"version": "1.0.0",
"description": "API endpoints for PSC Autocomplete and Funding Agency Autocomplete."
},
"servers": [
{
"url": "https://api.usaspending.gov"
}
],
"paths": {
"/api/v2/autocomplete/psc/": {
"post": {
"summary": "PSC Autocomplete",
"description": "Retrieves product or service (PSC) codes and their descriptions based on a search string.",
"operationId": "pscAutocompletePost",
"requestBody": {
"description": "Search text to autocomplete PSC codes.",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"limit": {
"type": "number"
},
"search_text": {
"type": "string"
}
},
"required": [
"search_text"
]
},
"example": {
"search_text": "Defense"
}
}
}
},
"responses": {
"200": {
"description": "Array of matching PSC codes and descriptions.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"$ref": "#/components/schemas/PSCMatch"
}
}
}
},
"example": {
"results": [
{
"product_or_service_code": "1234",
"psc_description": "Defense-related services"
}
]
}
}
}
}
}
}
},
"/api/v2/autocomplete/funding_agency/": {
"post": {
"summary": "Funding Agency Autocomplete",
"description": "Retrieves funding agencies matching the specified search text.",
"operationId": "fundingAgencyAutocompletePost",
"requestBody": {
"description": "Search text and limit for autocompleting funding agencies.",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"limit": {
"type": "number",
"default": 10
},
"search_text": {
"type": "string"
}
},
"required": [
"search_text"
]
},
"example": {
"search_text": "Defense"
}
}
}
},
"responses": {
"200": {
"description": "Array of matching funding agencies.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"$ref": "#/components/schemas/FundingAgencyMatch"
}
}
}
},
"example": {
"results": [
{
"id": 1,
"toptier_flag": true,
"toptier_agency": {
"toptier_code": "020",
"abbreviation": "DOD",
"name": "Department of Defense"
},
"subtier_agency": {
"abbreviation": "USA",
"name": "United States Army"
}
}
]
}
}
}
}
}
}
},
"/api/v2/recipient/{recipient_id}/": {
"get": {
"summary": "Specific Recipient Identifier",
"description": "Returns a high-level overview of a specific recipient, given its ID.",
"operationId": "specificRecipientIdentifierGet",
"parameters": [
{
"in": "path",
"name": "recipient_id",
"required": true,
"schema": {
"type": "string"
},
"description": "A unique identifier for the recipient at a specific level."
},
{
"in": "query",
"name": "year",
"required": false,
"schema": {
"type": "string"
},
"description": "The fiscal year you would like data for."
}
],
"responses": {
"200": {
"description": "High-level overview of the specific recipient.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RecipientOverview"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"PSCMatch": {
"type": "object",
"properties": {
"product_or_service_code": {
"type": "string"
},
"psc_description": {
"type": "string"
}
},
"required": [
"product_or_service_code",
"psc_description"
]
},
"FundingAgencyMatch": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"toptier_flag": {
"type": "boolean"
},
"toptier_agency": {
"type": "object",
"properties": {
"toptier_code": {
"type": "string"
},
"abbreviation": {
"type": "string",
"nullable": true
},
"name": {
"type": "string"
}
},
"required": [
"toptier_code",
"abbreviation",
"name"
]
},
"subtier_agency": {
"type": "object",
"properties": {
"abbreviation": {
"type": "string",
"nullable": true
},
"name": {
"type": "string"
}
},
"required": [
"abbreviation",
"name"
]
}
}
},
"RecipientOverview": {
"type": "object",
"properties": {
"name": {
"type": "string",
"nullable": true
},
"alternate_names": {
"type": "array",
"items": {
"type": "string"
}
},
"duns": {
"type": "string",
"nullable": true
},
"uei": {
"type": "string",
"nullable": true
},
"recipient_id": {
"type": "string"
},
"recipient_level": {
"type": "string",
"enum": [
"R",
"P",
"C"
]
},
"parent_id": {
"type": "string",
"nullable": true
},
"parent_name": {
"type": "string",
"nullable": true
},
"parent_duns": {
"type": "string",
"nullable": true
},
"parent_uei": {
"type": "string",
"nullable": true
},
"parents": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ParentRecipient"
}
},
"location": {
"$ref": "#/components/schemas/RecipientLocation"
},
"business_types": {
"type": "array",
"items": {
"type": "string"
}
},
"total_transaction_amount": {
"type": "number"
},
"total_transactions": {
"type": "number"
},
"total_face_value_loan_amount": {
"type": "number"
},
"total_face_value_loan_transactions": {
"type": "number"
}
}
}
}
}
}