@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api Associations
@base https://api.hubapi.com
@version v4
@auth OAuth2 | OAuth2 | ApiKey private-app-legacy in header | ApiKey private-app in header
@endpoints 10
@toc crm(10)

@endpoint POST /crm/v4/associations/usage/high-usage-report/{userId}
@desc Report high usage
@required {userId: int(int32)}
@returns(200) {enqueueTime: map{dateOnly: bool, timeZoneShift: int(int32), value: int(int32)}, userEmail: str, userId: int(int32)} # successful operation

@endpoint POST /crm/v4/associations/{fromObjectType}/{toObjectType}/batch/archive
@desc Remove associations
@required {fromObjectType: str, toObjectType: str, inputs: [map{from!: map, to!: [map]}]}
@returns(204) No content

@endpoint POST /crm/v4/associations/{fromObjectType}/{toObjectType}/batch/associate/default
@desc Associate records (default)
@required {fromObjectType: str, toObjectType: str, inputs: [map{from!: map, to!: map}]}
@returns(200) {completedAt: str(date-time), errors: [map], links: map, numErrors: int(int32), requestedAt: str(date-time), results: [map], startedAt: str(date-time), status: str} # successful operation

@endpoint POST /crm/v4/associations/{fromObjectType}/{toObjectType}/batch/create
@desc Associate records (labelled)
@required {fromObjectType: str, toObjectType: str, inputs: [map{from!: map, to!: map, types!: [map]}]}
@returns(201) {completedAt: str(date-time), links: map, requestedAt: str(date-time), results: [map], startedAt: str(date-time), status: str} # successful operation
@returns(207) {completedAt: str(date-time), errors: [map], links: map, numErrors: int(int32), requestedAt: str(date-time), results: [map], startedAt: str(date-time), status: str} # multiple statuses

@endpoint POST /crm/v4/associations/{fromObjectType}/{toObjectType}/batch/labels/archive
@desc Delete specific labels
@required {fromObjectType: str, toObjectType: str, inputs: [map{from!: map, to!: map, types!: [map]}]}
@returns(204) No content

@endpoint POST /crm/v4/associations/{fromObjectType}/{toObjectType}/batch/read
@desc Retrieve associations
@required {fromObjectType: str, toObjectType: str, inputs: [map{after: str, id!: str}]}
@returns(200) {completedAt: str(date-time), links: map, requestedAt: str(date-time), results: [map], startedAt: str(date-time), status: str} # successful operation
@returns(207) {completedAt: str(date-time), errors: [map], links: map, numErrors: int(int32), requestedAt: str(date-time), results: [map], startedAt: str(date-time), status: str} # multiple statuses

@endpoint PUT /crm/v4/objects/{fromObjectType}/{fromObjectId}/associations/default/{toObjectType}/{toObjectId}
@desc Associate records (default)
@required {fromObjectId: str, fromObjectType: str, toObjectId: str, toObjectType: str}
@returns(200) {completedAt: str(date-time), errors: [map], links: map, numErrors: int(int32), requestedAt: str(date-time), results: [map], startedAt: str(date-time), status: str} # successful operation

@endpoint GET /crm/v4/objects/{objectType}/{objectId}/associations/{toObjectType}
@desc Retrieve all associations by object type
@required {objectId: str, objectType: str, toObjectType: str}
@optional {after: str # The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results., limit: int(int32)=500 # The maximum number of results to display per page.}
@returns(200) {paging: map{next: map{after: str, link: str}}, results: [map]} # successful operation

@endpoint PUT /crm/v4/objects/{objectType}/{objectId}/associations/{toObjectType}/{toObjectId}
@desc Associate records (labelled)
@required {objectId: str, objectType: str, toObjectId: str, toObjectType: str}
@returns(201) {fromObjectId: str, fromObjectTypeId: str, labels: [str], toObjectId: str, toObjectTypeId: str} # successful operation

@endpoint DELETE /crm/v4/objects/{objectType}/{objectId}/associations/{toObjectType}/{toObjectId}
@desc Delete associations between two records
@required {objectId: str, objectType: str, toObjectId: str, toObjectType: str}
@returns(204) No content

@end
