Use this endpoint to create a new Code in the current context.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Request
Accepts a standard Code object with no read-only values specified. If codeType is not specified, the default SourceCode value is assumed. Note that codeType must be a valid Code Type available for your API key, as determined by /codeTypes.
You can set additional metadata on SourceCodes by specifying the ID properties. For example, to a set a Source Code's Campaign, set:
{
...
"campaign": {
"campaignId": 1234
}
}In this example, we’re creating a Tag Code called AFL-CIO which is a child of parentCodeId 20515 and applicable to Events and Locations.
POST /codes
{
"parentCodeId": 20515,
"name": "AFL-CIO",
"codeType": "Tag",
"supportedEntities": [
{
"name": "Events",
"isSearchable": true,
"isApplicable": true
},
{
"name": "Locations",
"isSearchable": true,
"isApplicable": true
}
]
}In this example, we're creating a SourceCode with all of the various metadata information available as defined in Common Models:
{
"name": "SourceCode 22-06-02",
"description": "Description of a source code",
"codeType": "SourceCode",
"campaign": {
"campaignId": 2541
},
"contactType": {
"contactTypeId": 82
},
"generalLedgerFund": {
"generalLedgerFundId": 69
},
"costCenter": {
"costCenterId": 47
},
"revenueStream": {
"revenueStreamId": 179
},
"mailMergeTemplate": {
"mailMergeTemplateId": 337
},
"isSourceCodeApplicable": true
}Response
If successful, the endpoint responds with HTTP Status Code 201 Created.
It is not possible to provide a supportedEntities list for Tags which includes Entities that are not included in the GET /codes/supportedEntities response. For Source Codes, the supportedEntities list is ignored, because the list of supported entities is fixed for all Source Codes.

