# Inspect a service


[API catalog](/reference/api/) · [Docker Engine overview](/reference/api/engine/version/v1.57/) · [Product manual](https://docs.docker.com/engine/) · [OpenAPI specification](/reference/api/engine/version/v1.57.yaml)

API version: 1.57





`GET /services/{id}`



## Connection and access

[API connection and authentication guidance](/reference/api/engine/version/v1.57/#connection)


Server: `/v1.57`

Effective security: alternatives are OR; schemes within an alternative are AND. An empty array declares no HTTP authentication requirement.

```json
null
```

## Example request

Replace placeholders and provide the required credentials or request body.

```console
curl \
  --request GET \
  --unix-socket "${DOCKER_SOCKET:-/var/run/docker.sock}" \
  --header 'Accept: application/json' \
  'http://localhost/v1.57/services/<ID>'
```



## Parameters

### id

Location: path. Required: yes.

ID or name of service.

```json
{
  "description": "ID or name of service.",
  "in": "path",
  "name": "id",
  "pointer": "/paths/~1services~1{id}/get/parameters/0",
  "required": true,
  "schema": {
    "type": "string"
  }
}
```

### insertDefaults

Location: query. Required: no.

Fill empty fields with default values.

```json
{
  "description": "Fill empty fields with default values.",
  "in": "query",
  "name": "insertDefaults",
  "pointer": "/paths/~1services~1{id}/get/parameters/1",
  "schema": {
    "default": false,
    "type": "boolean"
  }
}
```

## Request and responses

### Response 200 application/json

no error


Schema:

```json
{
  "$ref": "#/components/schemas/Service"
}
```









Schema example:
```json
{
  "CreatedAt": "2016-06-07T21:05:51.880065305Z",
  "Endpoint": {
    "Ports": [
      {
        "Protocol": "tcp",
        "PublishedPort": 30001,
        "TargetPort": 6379
      }
    ],
    "Spec": {
      "Mode": "vip",
      "Ports": [
        {
          "Protocol": "tcp",
          "PublishedPort": 30001,
          "TargetPort": 6379
        }
      ]
    },
    "VirtualIPs": [
      {
        "Addr": "10.255.0.2/16",
        "NetworkID": "4qvuz4ko70xaltuqbt8956gd1"
      },
      {
        "Addr": "10.255.0.3/16",
        "NetworkID": "4qvuz4ko70xaltuqbt8956gd1"
      }
    ]
  },
  "ID": "9mnpnzenvg8p8tdbtq4wvbkcz",
  "Spec": {
    "EndpointSpec": {
      "Mode": "vip",
      "Ports": [
        {
          "Protocol": "tcp",
          "PublishedPort": 30001,
          "TargetPort": 6379
        }
      ]
    },
    "Mode": {
      "Replicated": {
        "Replicas": 1
      }
    },
    "Name": "hopeful_cori",
    "RollbackConfig": {
      "Delay": 1000000000,
      "FailureAction": "pause",
      "MaxFailureRatio": 0.15,
      "Monitor": 15000000000,
      "Parallelism": 1
    },
    "TaskTemplate": {
      "ContainerSpec": {
        "Image": "redis"
      },
      "ForceUpdate": 0,
      "Placement": {},
      "Resources": {
        "Limits": {},
        "Reservations": {}
      },
      "RestartPolicy": {
        "Condition": "any",
        "MaxAttempts": 0
      }
    },
    "UpdateConfig": {
      "Delay": 1000000000,
      "FailureAction": "pause",
      "MaxFailureRatio": 0.15,
      "Monitor": 15000000000,
      "Parallelism": 1
    }
  },
  "UpdatedAt": "2016-06-07T21:07:29.962229872Z",
  "Version": {
    "Index": 19
  }
}
```


### Response 200 text/plain

no error


Schema:

```json
{
  "$ref": "#/components/schemas/Service"
}
```









Schema example:
```json
{
  "CreatedAt": "2016-06-07T21:05:51.880065305Z",
  "Endpoint": {
    "Ports": [
      {
        "Protocol": "tcp",
        "PublishedPort": 30001,
        "TargetPort": 6379
      }
    ],
    "Spec": {
      "Mode": "vip",
      "Ports": [
        {
          "Protocol": "tcp",
          "PublishedPort": 30001,
          "TargetPort": 6379
        }
      ]
    },
    "VirtualIPs": [
      {
        "Addr": "10.255.0.2/16",
        "NetworkID": "4qvuz4ko70xaltuqbt8956gd1"
      },
      {
        "Addr": "10.255.0.3/16",
        "NetworkID": "4qvuz4ko70xaltuqbt8956gd1"
      }
    ]
  },
  "ID": "9mnpnzenvg8p8tdbtq4wvbkcz",
  "Spec": {
    "EndpointSpec": {
      "Mode": "vip",
      "Ports": [
        {
          "Protocol": "tcp",
          "PublishedPort": 30001,
          "TargetPort": 6379
        }
      ]
    },
    "Mode": {
      "Replicated": {
        "Replicas": 1
      }
    },
    "Name": "hopeful_cori",
    "RollbackConfig": {
      "Delay": 1000000000,
      "FailureAction": "pause",
      "MaxFailureRatio": 0.15,
      "Monitor": 15000000000,
      "Parallelism": 1
    },
    "TaskTemplate": {
      "ContainerSpec": {
        "Image": "redis"
      },
      "ForceUpdate": 0,
      "Placement": {},
      "Resources": {
        "Limits": {},
        "Reservations": {}
      },
      "RestartPolicy": {
        "Condition": "any",
        "MaxAttempts": 0
      }
    },
    "UpdateConfig": {
      "Delay": 1000000000,
      "FailureAction": "pause",
      "MaxFailureRatio": 0.15,
      "Monitor": 15000000000,
      "Parallelism": 1
    }
  },
  "UpdatedAt": "2016-06-07T21:07:29.962229872Z",
  "Version": {
    "Index": 19
  }
}
```


### Response 404 application/json

no such service


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


### Response 500 application/json

server error


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


### Response 503 application/json

node is not part of a swarm


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


## Complete operation contract

```json
{
  "operationId": "ServiceInspect",
  "parameters": [
    {
      "description": "ID or name of service.",
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Fill empty fields with default values.",
      "in": "query",
      "name": "insertDefaults",
      "schema": {
        "default": false,
        "type": "boolean"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Service"
          }
        },
        "text/plain": {
          "schema": {
            "$ref": "#/components/schemas/Service"
          }
        }
      },
      "description": "no error"
    },
    "404": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "no such service"
    },
    "500": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "server error"
    },
    "503": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "node is not part of a swarm"
    }
  },
  "summary": "Inspect a service",
  "tags": [
    "Service"
  ]
}
```

## Referenced schemas

- [#/components/schemas/ErrorResponse](/reference/api/engine/version/v1.57/schemas/ErrorResponse/)

- [#/components/schemas/Service](/reference/api/engine/version/v1.57/schemas/Service/)




