---
sidebar_label: Action specifications for links
toc_max_heading_level: 3
doc_id: 8a850b72-ccba-4bc5-9636-89bcf0c71e35
description: >-
  Guide for creating action specifications for links, supporting create, update,
  delete, and custom actions.
keywords:
  - link specifications
  - action specifications
  - API
  - create action
  - custom actions
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Action specifications for links

## What actions need to be specified?

Links support the exact same set of actions as services: create, update, delete, and custom actions.

## How should I implement these actions?

:::info
New link specifications autogenerate their `create`, `update`, and `delete` actions by default (`use_default_actions: true`), so you only need the examples below when the spec was created with `"use_default_actions": false` or when adding `custom` actions. See [Link specifications](/docs/services/craft-a-service/link-specs#defining-standard-actions-in-the-link-spec) for details.
:::

Creating action specifications for a link follows the same process as creating your service actions.

The only consideration is that instead of using URLs like:

```
/service_specification/:id/action_specification
```

you will use URLs like:

```
/link_specification/:id/action_specification
```

For more info on how service actions work, refer to the [action specifications](/docs/services/craft-a-service/service-actions)
docs.


## Link action specifications

Action specifications for links work the same way as they do for services. Here are examples for create, update,
delete, and custom link actions.

### Create

<Tabs
defaultValue="create-link-action-cli"
values={[
{ label: 'CLI', value: 'create-link-action-cli' },
{ label: 'cURL', value: 'create-link-action-curl' },
]}>
<TabItem value="create-link-action-cli">

    ```bash
    np link-specification action-specification create \
     --linkSpecificationId $link_spec_id \
     --body '{
        "name": "Create my link action spec",
        "type": "create",
        "parameters": {
          "schema": {
            "type": "object",
            "properties": {
              "my_string_property": {
                "type": "string"
              },
              "my_number_property": {
                "type": "number",
                "default": 0
              }
            },
            "required": [
              "my_string_property"
            ]
          },
          "values": {}
        },
        "results": {
          "schema": {
            "type": "object",
            "properties": {
              "my_string_property": {
                "type": "string"
              },
              "my_number_property": {
                "type": "number",
                "default": 0
              }
            },
            "required": [
              "my_string_property"
            ]
          },
          "values": {}
        },
        "service_specification_id": "134544a6-a089-43ba-9d52-5b6e6e4fa8d1",
        "link_specification_id": "f3e8be90-0952-4506-bd54-c4e75a5a4393"
      }'
    ```

  </TabItem>
  <TabItem value="create-link-action-curl">

    ```bash
    curl -X POST "https://api.nullplatform.com/link_specification/$link_spec_id/action_specification" \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer <token>" \
      -d '{
        "name": "Create my link action",
        "type": "create",
        "parameters": {
          "schema": {
            "type": "object",
            "properties": {
              "my_string_property": {
                "type": "string"
              },
              "my_number_property": {
                "type": "number",
                "default": 0
              }
            },
            "required": [
              "my_string_property"
            ]
          },
          "values": {}
        },
        "results": {
          "schema": {
            "type": "object",
            "properties": {
              "my_string_property": {
                "type": "string"
              },
              "my_number_property": {
                "type": "number",
                "default": 0
              }
            },
            "required": [
              "my_string_property"
            ]
          },
          "values": {}
        },
        "service_specification_id": "134544a6-a089-43ba-9d52-5b6e6e4fa8d1",
        "link_specification_id": "f3e8be90-0952-4506-bd54-c4e75a5a4393"
      }'
    ```

  </TabItem>
</Tabs>

### Delete

<Tabs
defaultValue="create-link-delete-action-cli"
values={[
{ label: 'CLI', value: 'create-link-delete-action-cli' },
{ label: 'cURL', value: 'create-link-delete-action-curl' },
]}>
<TabItem value="create-link-delete-action-cli">

    ```bash
    np link-specification action-specification create \
     --linkSpecificationId $link_spec_id \
     --body '{
        "name": "Create my link delete action spec",
        "type": "delete",
        "parameters": {
          "schema": {
            "type": "object",
            "properties": {
              "my_string_property": {
                "type": "string"
              },
              "my_number_property": {
                "type": "number",
                "default": 0
              }
            },
            "required": [
              "my_string_property"
            ]
          },
          "values": {}
        },
        "results": {
          "schema": {
            "type": "object",
            "properties": {
              "my_string_property": {
                "type": "string"
              },
              "my_number_property": {
                "type": "number",
                "default": 0
              }
            },
            "required": [
              "my_string_property"
            ]
          },
          "values": {}
        },
        "service_specification_id": "134544a6-a089-43ba-9d52-5b6e6e4fa8d1",
        "link_specification_id": "f3e8be90-0952-4506-bd54-c4e75a5a4393"
      }'
    ```

  </TabItem>
  <TabItem value="create-link-delete-action-curl">

    ```bash
    curl -X POST "https://api.nullplatform.com/link_specification/$link_spec_id/action_specification" \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer <token>" \
      -d '{
        "name": "Create my link delete action spec",
        "type": "delete",
        "parameters": {
          "schema": {
            "type": "object",
            "properties": {
              "my_string_property": {
                "type": "string"
              },
              "my_number_property": {
                "type": "number",
                "default": 0
              }
            },
            "required": [
              "my_string_property"
            ]
          },
          "values": {}
        },
        "results": {
          "schema": {
            "type": "object",
            "properties": {
              "my_string_property": {
                "type": "string"
              },
              "my_number_property": {
                "type": "number",
                "default": 0
              }
            },
            "required": [
              "my_string_property"
            ]
          },
          "values": {}
        },
        "service_specification_id": "134544a6-a089-43ba-9d52-5b6e6e4fa8d1",
        "link_specification_id": "f3e8be90-0952-4506-bd54-c4e75a5a4393"
      }'
    ```

  </TabItem>
</Tabs>

### Update

<Tabs
defaultValue="create-link-update-action-cli"
values={[
{ label: 'CLI', value: 'create-link-update-action-cli' },
{ label: 'cURL', value: 'create-link-update-action-curl' },
]}>
<TabItem value="create-link-update-action-cli">

    ```bash
    np link-specification action-specification create \
     --linkSpecificationId $link_spec_id \
     --body '{
        "name": "Create my link update action spec",
        "type": "update",
        "parameters": {
          "schema": {
            "type": "object",
            "properties": {
              "my_string_property": {
                "type": "string"
              },
              "my_number_property": {
                "type": "number",
                "default": 0
              }
            },
            "required": [
              "my_string_property"
            ]
          },
          "values": {}
        },
        "results": {
          "schema": {
            "type": "object",
            "properties": {
              "my_string_property": {
                "type": "string"
              },
              "my_number_property": {
                "type": "number",
                "default": 0
              }
            },
            "required": [
              "my_string_property"
            ]
          },
          "values": {}
        },
        "service_specification_id": "134544a6-a089-43ba-9d52-5b6e6e4fa8d1",
        "link_specification_id": "f3e8be90-0952-4506-bd54-c4e75a5a4393"
      }'
    ```

  </TabItem>
  <TabItem value="create-link-update-action-curl">

    ```bash
    curl -X POST "https://api.nullplatform.com/link_specification/$link_spec_id/action_specification" \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer <token>" \
      -d '{
        "name": "Create my link update action spec",
        "type": "update",
        "parameters": {
          "schema": {
            "type": "object",
            "properties": {
              "my_string_property": {
                "type": "string"
              },
              "my_number_property": {
                "type": "number",
                "default": 0
              }
            },
            "required": [
              "my_string_property"
            ]
          },
          "values": {}
        },
        "results": {
          "schema": {
            "type": "object",
            "properties": {
              "my_string_property": {
                "type": "string"
              },
              "my_number_property": {
                "type": "number",
                "default": 0
              }
            },
            "required": [
              "my_string_property"
            ]
          },
          "values": {}
        },
        "service_specification_id": "134544a6-a089-43ba-9d52-5b6e6e4fa8d1",
        "link_specification_id": "f3e8be90-0952-4506-bd54-c4e75a5a4393"
      }'
    ```

  </TabItem>
</Tabs>

### Custom

<Tabs
defaultValue="create-link-custom-action-cli"
values={[
{ label: 'CLI', value: 'create-link-custom-action-cli' },
{ label: 'cURL', value: 'create-link-custom-action-curl' },
]}>
<TabItem value="create-link-custom-action-cli">

    ```bash
    np link-specification action-specification create \
     --linkSpecificationId $link_spec_id \
     --body '{
        "name": "Create my link custom action spec",
        "type": "custom",
        "parameters": {
          "schema": {
            "type": "object",
            "properties": {
              "my_string_property": {
                "type": "string"
              },
              "my_number_property": {
                "type": "number",
                "default": 0
              }
            },
            "required": [
              "my_string_property"
            ]
          },
          "values": {}
        },
        "results": {
          "schema": {
            "type": "object",
            "properties": {
              "my_string_property": {
                "type": "string"
              },
              "my_number_property": {
                "type": "number",
                "default": 0
              }
            },
            "required": [
              "my_string_property"
            ]
          },
          "values": {}
        },
        "service_specification_id": "134544a6-a089-43ba-9d52-5b6e6e4fa8d1",
        "link_specification_id": "f3e8be90-0952-4506-bd54-c4e75a5a4393"
      }'
    ```

  </TabItem>
  <TabItem value="create-link-custom-action-curl">

    ```bash
    curl -X POST "https://api.nullplatform.com/link_specification/$link_spec_id/action_specification" \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer <token>" \
      -d '{
        "name": "Create my link custom action",
        "type": "custom",
        "parameters": {
          "schema": {
            "type": "object",
            "properties": {
              "my_string_property": {
                "type": "string"
              },
              "my_number_property": {
                "type": "number",
                "default": 0
              }
            },
            "required": [
              "my_string_property"
            ]
          },
          "values": {}
        },
        "results": {
          "schema": {
            "type": "object",
            "properties": {
              "my_string_property": {
                "type": "string"
              },
              "my_number_property": {
                "type": "number",
                "default": 0
              }
            },
            "required": [
              "my_string_property"
            ]
          },
          "values": {}
        },
        "service_specification_id": "134544a6-a089-43ba-9d52-5b6e6e4fa8d1",
        "link_specification_id": "f3e8be90-0952-4506-bd54-c4e75a5a4393"
      }'
    ```

  </TabItem>
</Tabs>
