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

@endpoint GET /crm/v3/objects/contacts
@optional {after: str, archived: bool=false, associations: [str], limit: int(int32)=10, properties: [str], propertiesWithHistory: [str]}
@returns(200) {paging: map{next: map{after: str, link: str}}, results: [map]}

@endpoint POST /crm/v3/objects/contacts
@required {associations: [map{to!: map, types!: [map]}], properties: map}
@returns(201) {archived: bool, archivedAt: str(date-time), createdAt: str(date-time), id: str, objectWriteTraceId: str, properties: map, propertiesWithHistory: map, updatedAt: str(date-time), url: str}

@endpoint POST /crm/v3/objects/contacts/batch/archive
@required {inputs: [map{id!: str}]}
@returns(204)

@endpoint POST /crm/v3/objects/contacts/batch/create
@required {inputs: [map{associations!: [map], objectWriteTraceId: str, properties!: map}]}
@returns(201) {completedAt: str(date-time), links: map, requestedAt: str(date-time), results: [map], startedAt: str(date-time), status: str}
@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}

@endpoint POST /crm/v3/objects/contacts/batch/read
@required {inputs: [map{id!: str}], properties: [str], propertiesWithHistory: [str]}
@optional {archived: bool=false, idProperty: str}
@returns(200) {completedAt: str(date-time), links: map, requestedAt: str(date-time), results: [map], startedAt: str(date-time), status: str}
@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}

@endpoint POST /crm/v3/objects/contacts/batch/update
@required {inputs: [map{id!: str, idProperty: str, objectWriteTraceId: str, properties!: map}]}
@returns(200) {completedAt: str(date-time), links: map, requestedAt: str(date-time), results: [map], startedAt: str(date-time), status: str}
@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}

@endpoint POST /crm/v3/objects/contacts/batch/upsert
@required {inputs: [map{id!: str, idProperty: str, objectWriteTraceId: str, properties!: map}]}
@returns(200) {completedAt: str(date-time), links: map, requestedAt: str(date-time), results: [map], startedAt: str(date-time), status: str}
@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}

@endpoint POST /crm/v3/objects/contacts/gdpr-delete
@required {objectId: str}
@optional {idProperty: str}
@returns(204)

@endpoint POST /crm/v3/objects/contacts/merge
@required {objectIdToMerge: str, primaryObjectId: str}
@returns(200) {archived: bool, archivedAt: str(date-time), createdAt: str(date-time), id: str, objectWriteTraceId: str, properties: map, propertiesWithHistory: map, updatedAt: str(date-time), url: str}

@endpoint POST /crm/v3/objects/contacts/search
@required {after: str, filterGroups: [map{filters!: [map]}], limit: int(int32), properties: [str], sorts: [str]}
@optional {query: str}
@returns(200) {paging: map{next: map{after: str, link: str}, prev: map{before: str, link: str}}, results: [map], total: int(int32)}

@endpoint GET /crm/v3/objects/contacts/{contactId}
@required {contactId: str}
@optional {archived: bool=false, associations: [str], idProperty: str, properties: [str], propertiesWithHistory: [str]}
@returns(200) {archived: bool, archivedAt: str(date-time), associations: map, createdAt: str(date-time), id: str, objectWriteTraceId: str, properties: map, propertiesWithHistory: map, updatedAt: str(date-time), url: str}

@endpoint DELETE /crm/v3/objects/contacts/{contactId}
@required {contactId: str}
@returns(204)

@endpoint PATCH /crm/v3/objects/contacts/{contactId}
@required {contactId: str, properties: map}
@optional {idProperty: str}
@returns(200) {archived: bool, archivedAt: str(date-time), createdAt: str(date-time), id: str, objectWriteTraceId: str, properties: map, propertiesWithHistory: map, updatedAt: str(date-time), url: str}

@end
