Custom functions

Custom functions are functions you or your team members create that you can use in a scenario. The following API endpoints allow you to:

  • list

  • evaluate

  • create

  • update

  • delete

  • check version history

of your custom functions.

Check the custom functions feature documentation in the Make Help center.

List custom functions

get

Retrieves a list of custom functions available in the team. The response contains id, name, description and a brief updates history of all custom functions available in the team.

Check availability of the custom functions feature with the API call GET /organizations/{organizationId} for the organization to which the team belongs. If the response contains "customFunctions": true pair in the license object then you have access to the custom functions feature.

Refer to the Make pricing page for Make pricing plans overview.

Authorizations
Query parameters
teamIdintegerRequired

The ID of the team.

Example: 11
colsstring[]Optional

Specifies columns that are returned in the response. Use the cols[] parameter for every column that you want to return in the response. For example GET /endpoint?cols[]=key1&cols[]=key2 to get both key1 and key2 columns in the response.

Check the "Filtering" section for a full example.

Responses
200
Successful response
application/json
get
GET /api/v2/functions HTTP/1.1
Host: eu1.make.com
Authorization: YOUR_API_KEY
Accept: */*
200

Successful response

{
  "functions": [
    {
      "id": 2,
      "name": "checkType",
      "args": "(param)",
      "description": "Returns the data type of the argument.",
      "updatedAt": "2023-02-06T09:10:40.643Z",
      "createdByUser": {
        "id": 22,
        "name": "John Doe",
        "email": "[email protected]"
      },
      "createdAt": "2023-02-06T09:09:16.063Z"
    },
    {
      "id": 3,
      "name": "numberOfWorkingDays",
      "args": "()",
      "description": "Calculate how many working days are between the two provided dates.",
      "updatedAt": "2023-01-25T12:49:51.601Z",
      "createdByUser": {
        "id": 22,
        "name": "John Doe",
        "email": "[email protected]"
      },
      "createdAt": "2023-01-25T12:49:51.601Z"
    }
  ]
}

Create a custom function

post

Creates a custom function. Specify function name, description and code in the request body.

You cannot use a JavaScript reserved word for the function name. Check the list of JavaScript reserved words.

Make sure to use the same function name in the name field and in the function's code. Otherwise, you get the IM005 error.

Make validates the custom function's code first. You get an IM005 error if the code validation fails. The validation might fail because of a syntax error in the function's code or when the code uses a JavaScript feature that Make doesn't support. Check the custom functions limitations in the Make Help center.

Check availability of the custom functions feature with the API call GET /organizations/{organizationId} for the organization to which the team belongs. If the response contains "customFunctions": true pair in the license object then you have access to the custom functions feature.

Refer to the Make pricing page for Make pricing plans overview.

Authorizations
Query parameters
teamIdintegerRequired

The ID of the team.

Example: 11
Body
namestringRequired

The name of the custom function.

descriptionstringRequired

The description of the custom function.

codestringOptional

The code of the custom function.

Responses
200
Successful response
application/json
post
POST /api/v2/functions HTTP/1.1
Host: eu1.make.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 291

{
  "name": "symmetricDifference",
  "description": "A function which returns an array with items unique across two arrays.",
  "code": "function symmetricDifference(array1, array2){difference = array1.filter(x => !array2.includes(x)).concat(array2.filter(x => !array1.includes(x))) return difference}"
}
200

Successful response

{
  "function": {
    "id": 16,
    "name": "symmetricDifference",
    "description": "A function which returns an array with items unique across two arrays.",
    "code": "function symmetricDifference(array1, array2){difference = array1.filter(x => !array2.includes(x)).concat(array2.filter(x => !array1.includes(x))) return difference}",
    "args": "(array1, array2)",
    "updatedAt": "2023-02-06T14:09:37.834Z",
    "createdAt": "2023-02-06T14:09:37.834Z",
    "createdByUser": {
      "id": 22,
      "name": "John Doe",
      "email": "[email protected]"
    }
  }
}

Check custom function code

post

Checks the custom functions code. The response contains information whether Make validated the custom functions code successfully or whether there was an error.

The code validation might fail because of an syntax error in the function's code or when the code uses a JavaScript feature that Make doesn't support. Check the custom functions limitations in the Make Help center.

Check availability of the custom functions feature with the API call GET /organizations/{organizationId} for the organization to which the team belongs. If the response contains "customFunctions": true pair in the license object then you have access to the custom functions feature.

Refer to the Make pricing page for Make pricing plans overview.

Authorizations
Query parameters
teamIdintegerRequired

The ID of the team.

Example: 11
Body
codestringRequired

The code of the custom function.

Responses
200
Successful response
application/json
post
POST /api/v2/functions/eval HTTP/1.1
Host: eu1.make.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 57

{
  "code": "function checkType(arg) {return (typeof(arg))}"
}
200

Successful response

{
  "success": true,
  "error": null
}

Custom function detail

get

Gets detailed information about a custom function. The response contains function name, code, a list of scenarios which use the custom function and the custom function's history of updates.

Authorizations
Path parameters
functionIdintegerRequired

The ID of the custom function.

Example: 44
Query parameters
colsstring[]Optional

Specifies columns that are returned in the response. Use the cols[] parameter for every column that you want to return in the response. For example GET /endpoint?cols[]=key1&cols[]=key2 to get both key1 and key2 columns in the response.

Check the "Filtering" section for a full example.

Responses
200
Successful response
application/json
get
GET /api/v2/functions/{functionId} HTTP/1.1
Host: eu1.make.com
Authorization: YOUR_API_KEY
Accept: */*
200

Successful response

{
  "function": {
    "id": 16,
    "name": "symmetricDifference",
    "description": "A function which returns an array with items unique across two arrays.",
    "code": "function symmetricDifference(array1, array2){difference = array1.filter(x => !array2.includes(x)).concat(array2.filter(x => !array1.includes(x))) return difference}",
    "args": "(array1, array2)",
    "scenarios": [
      {
        "id": 1052,
        "name": "Scenario to compare arrays"
      }
    ],
    "updatedAt": "2023-02-06T14:09:37.834Z",
    "createdAt": "2023-02-06T14:09:37.834Z",
    "createdByUser": {
      "id": 22,
      "name": "John Doe",
      "email": "[email protected]"
    }
  }
}

Delete custom function

delete

Deletes the custom function. The response contains information whether the custom function is deleted or not.

If you or any of your team members use the custom function in a scenario you have to use the confirmed parameter to confirm the custom function deletion. Otherwise, you get an error with a list of scenarios that use the custom function.

Authorizations
Path parameters
functionIdintegerRequired

The ID of the custom function.

Example: 44
Query parameters
confirmedbooleanOptional

Confirms deleting of the custom function. If you are using the custom function in a scenario Make requires the confirmation.

Example: true
Responses
200
Successful response
application/json
delete
DELETE /api/v2/functions/{functionId} HTTP/1.1
Host: eu1.make.com
Authorization: YOUR_API_KEY
Accept: */*
200

Successful response

{
  "success": true
}

Update a custom function

patch

Updates custom functions description or code. You cannot change the name of the custom function.

Make sure to use the same function name in the function's code. Otherwise, you get an IM005 error.

Make validates the custom function's code first. You get an IM005 error if the code validation fails. The validation might fail because of a syntax error in the function's code or when the code uses a JavaScript feature that Make doesn't support. Check the custom functions limitations in the Make Help center.

Authorizations
Path parameters
functionIdintegerRequired

The ID of the custom function.

Example: 44
Body
descriptionstringOptional

The description of the custom function. You can use maximum of 128 characters.

codestringOptional

The code of the custom function.

Responses
200
Successful response
application/json
patch
PATCH /api/v2/functions/{functionId} HTTP/1.1
Host: eu1.make.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 121

{
  "description": "Greet user instead of greeting the World.",
  "code": "function greeter(name){return concat('Hello ', name)"
}
200

Successful response

{
  "function": {
    "id": 48,
    "name": "greeter",
    "description": "Greet user instead of greeting the World.",
    "code": "function greeter(name){return concat('Hello ', name)",
    "args": "(name)",
    "updatedAt": "2023-02-06T14:09:37.834Z",
    "createdAt": "2023-02-06T14:09:37.834Z",
    "createdByUser": {
      "id": 22,
      "name": "John Doe",
      "email": "[email protected]"
    }
  }
}

Custom function updates history

get

Gets history of updates of the specified custom function. The response contains a list of code changes, the change author and date when the author made the change.

Authorizations
Path parameters
functionIdintegerRequired

The ID of the custom function.

Example: 44
Query parameters
teamIdintegerRequired

The ID of the team.

Example: 11
Responses
200
Successful response
application/json
get
GET /api/v2/functions/{functionId}/history HTTP/1.1
Host: eu1.make.com
Authorization: YOUR_API_KEY
Accept: */*
200

Successful response

{
  "functionHistory": [
    {
      "id": 1245,
      "previousCode": "function checkType(param){return typeof(param)}",
      "updatedAt": "2023-02-09T09:13:36.750Z",
      "updatedBy": "John Doe"
    },
    {
      "id": 1240,
      "previousCode": "function checkType(arg){return typeof(arg)}",
      "updatedAt": "2023-02-09T09:12:34.288Z",
      "updatedBy": "John Doe"
    }
  ]
}