# Relations Relations define typed connections between CaraerObjects, enabling graph-like data modeling. A Relation specifies how Records of one Object can connect to Records of another Object (e.g., "Candidate applies to Vacancy", "Company has Employees"). Relations create directed or bidirectional relationships between Records, allowing navigation and querying of related data. Relations support cardinality, directionality, and can be used in filtering, sorting, and querying Records. They enable complex data structures where Records reference each other, creating a graph database model on top of the object-oriented schema. Relations are essential for modeling real-world relationships between entities and enable powerful querying capabilities across connected Records. ## Add a connection to a relation - [PUT /api/v2/relations/{relationUuid}/connection/{from}/{to}](https://developer.caraer.com/apis/relations/addconnection.md): Creates a connection between two objects for a given relation. The 'from' and 'to' UUIDs identify the objects to connect. ## Delete a connection from a relation - [DELETE /api/v2/relations/{relationUuid}/connection/{from}/{to}](https://developer.caraer.com/apis/relations/deleteconnection.md): Deletes a connection between two objects for a given relation using the specified UUIDs. ## Update relation indices - [PUT /api/v2/relations/updateIndices](https://developer.caraer.com/apis/relations/updateindices.md): Updates the indices for relations. The request body should contain a mapping of relation UUIDs to their new index values. Returns a SuccessResponse containing the updated relation objects. ## Create or update a relation - [POST /api/v2/relations/{objectUuid}](https://developer.caraer.com/apis/relations/createrelationorupdate.md): Creates a new relation or updates an existing one for the specified object. If a relation with the same name exists, it is updated; otherwise, a new relation is created. Returns an UpdateResponse if updated or a CreateResponse if created. ## Fetch paginated relations - [POST /api/v2/relations/index](https://developer.caraer.com/apis/relations/getrelations.md): Retrieves a paginated list of relations. Returns a PaginationResponse containing RelationDTO objects based on the provided pagination criteria. ## Fetch relations for a specific object - [POST /api/v2/relations/index/{objectUuid}](https://developer.caraer.com/apis/relations/getrelationsbyobject.md): Retrieves a paginated list of relations associated with the specified object UUID. The relations are filtered using a custom Cypher query based on the object's name. ## Get all relations between two objects - [POST /api/v2/relations/index/{fromObjectUuid}/{toObjectUuid}](https://developer.caraer.com/apis/relations/getrelationsbetweenobjects.md): Retrieves all relations between two objects based on the provided object UUIDs. ## Get relation details - [GET /api/v2/relations/{relationUuid}](https://developer.caraer.com/apis/relations/getrelation.md): Retrieves the details of a relation by its UUID. Returns a ShowResponse containing a RelationDTO. ## Delete a relation - [DELETE /api/v2/relations/{relationUuid}](https://developer.caraer.com/apis/relations/deleterelation_1.md): Deletes a relation specified by its UUID. Returns a DeleteResponse with the deleted relation details. ## Restore a deleted relation - [PATCH /api/v2/relations/{relationUuid}](https://developer.caraer.com/apis/relations/patchrelation.md): Restores a soft-deleted relation identified by its UUID. Returns a RestoreResponse containing the restored relation details. ## Get relation details for a specific object - [GET /api/v2/relations/{relationUuid}/{objectUuid}](https://developer.caraer.com/apis/relations/getrelationforobject.md): Retrieves a relation by its UUID and associates it with the specified object, returning a RelationDTO that includes details from the related object.