Creating receivers

When making API requests to our system, it is important to include the authorization token in the Authorization header to authenticate your requests. The correct format for including the token is:

Authorization: Bearer ${ACCESS_TOKEN}

For detailed information on obtaining and using access tokens, please refer to the Authentication section of our documentation.

Create receiver

Creates a new receiver for the currently authenticated user by providing the following information:

  • Receiver type - COMPANY

{
  "legalName": "ABC Inc.",
  "address": "123 Main St.",
  "type": "COMPANY",
  "countryIsoCode": "US",
  "email": "john.mayer@example.com"
}
  • Receiver type - INDIVIDUAL

{
  "firstName": "John",
  "lastName": "Mayer",
  "address": "123 Main St.",
  "type": "INDIVIDUAL",
  "countryIsoCode": "US",
  "email": "john.mayer@example.com"
}

If the receiver was successfully created, you will receive information about the newly created receiver as shown below:

{
  "firstName": null,
  "lastName": null,
  "legalName": "ABC Inc.",
  "address": "123 Main St.",
  "type": "COMPANY",
  "email": "john.mayer@example.com",
  "owner": "63ebc79156940ab1c9c32210",
  "country": {
    "_id": "63ebc49a227fcc69535bb949",
    "name": "United States",
    "isoCode3166": "US",
    "continent": "NA",
    "createdAt": "2023-02-14T17:27:54.382Z",
    "updatedAt": "2023-02-14T17:27:54.382Z",
    "__v": 0
  },
  "_id": "642312c96eb191e45530ea2d",
  "createdAt": "2023-03-28T16:16:09.447Z",
  "updatedAt": "2023-03-28T16:16:09.447Z"
}

Note: Country information is available through our Country endpoint

Get a receiver by ID

Retrieves a receiver by id

If the receiver is associated with the currently authenticated user, a 200 status code will be returned, accompanied by the receiver's details. Conversely, if the receiver cannot be located or is not linked to the current user, a 404 status code will be generated, along with an error message.

Example Response (Success):

{
  "_id": "642312c96eb191e45530ea2d",
  "firstName": null,
  "lastName": null,
  "legalName": "ABC Inc.",
  "address": "123 Main St.",
  "type": "COMPANY",
  "email": "john.mayer@example.com",
  "owner": "63ebc79156940ab1c9c32210",
  "country": {
    "_id": "63ebc49a227fcc69535bb949",
    "name": "United States",
    "isoCode3166": "US",
    "continent": "NA",
    "createdAt": "2023-02-14T17:27:54.382Z",
    "updatedAt": "2023-02-14T17:27:54.382Z",
    "__v": 0
  },
  "createdAt": "2023-03-28T16:16:09.447Z",
  "updatedAt": "2023-03-28T16:16:09.447Z"
}

Example Response (Error):

{
  "statusCode": 404,
  "message": "Receiver not found",
  "error": "Not Found"
}

Update a receiver by ID

Modifies a receiver with a specified ID belonging to the currently authenticated user.

Below is a sample update payload:

{
  "address": "123 Main St.",
  "countryIsoCode": "PT",
  "email": "jane.doe@example.com"
}

If the receiver was successfully updated, the API will return the updated receiver entity with the following properties:

{
  "_id": "642312c96eb191e45530ea2d",
  "firstName": null,
  "lastName": null,
  "legalName": "ABC Inc.",
  "address": "123 Main St.",
  "type": "COMPANY",
  "email": "jane.doe@example.com",
  "owner": "63ebc79156940ab1c9c32210",
  "country": {
    "_id": "63ebc49a227fcc69535bb949",
    "name": "United States",
    "isoCode3166": "US",
    "continent": "NA",
    "createdAt": "2023-02-14T17:27:54.382Z",
    "updatedAt": "2023-02-14T17:27:54.382Z",
    "__v": 0
  },
  "createdAt": "2023-03-28T16:16:09.447Z",
  "updatedAt": "2023-03-28T16:52:52.304Z"
}

If the current user lacks permission to update the receiver, a response with a 403 Forbidden status code will be returned, accompanied by a message indicating the user's insufficient access rights to modify the receiver:

{
  "statusCode": 403,
  "message": "This user can't update this receiver",
  "error": "Forbidden"
}

If the specified receiver does not exist, you will receive a response with a 404 Not Found status code and a message indicating that the receiver could not be found:

{
  "statusCode": 404,
  "message": "This receiver doesn't exist",
  "error": "Forbidden"
}

Last updated