# ESD 1.4.0


# 健康检查（Ping）

<a id="opIdTestConnection"></a>

## GET 健康检查 （Ping）

GET /ping

测试客户端是否可以连接到 API，并检查配置是否正确。
Test whether client can connect to api and check the API_TOKEN is correct.

> Response Examples

> Success

```json
{
  "message": "pong",
  "statusCode": 200
}
```

### Responses

|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Success|Inline|

### Responses Data Schema

HTTP Status Code **200**

|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» message|string|true|none||none|
|» statusCode|integer|true|none||none|

# 角色（Roles）

<a id="opIdListRoles"></a>

## DELETE 删除角色 DeleteRoles

DELETE /roles

删除角色
Delete roles

> Body Parameters

```json
{
  "role_name_list": [
    "role_name_1"
  ]
}
```

### Params

|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|Authorization|header|string| yes |none|
|body|body|object| no |none|
|» role_name_list|body|[string]| yes |角色列表（Role Name List）|

> Response Examples

> 204 Response

```json
{}
```

### Responses

|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|No Content|Inline|

### Responses Data Schema

<a id="opIdCreateRole"></a>

## POST 创建角色 CreateRole

POST /roles

创建新角色
Create a new role

> Body Parameters

```json
{
  "role_name": "new_role_name",
  "creator": "admin",
  "permissions": [
    "train:all",
    "checkpoint:all"
  ]
}
```

### Params

|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|Authorization|header|string| yes |none|
|body|body|[Role](#schemarole)| no |none|

> Response Examples

> Created

```json
{
  "statusCode": 201,
  "message": "role created"
}
```

### Responses

|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|Created|Inline|

### Responses Data Schema

HTTP Status Code **201**

|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» statusCode|integer|true|none||none|
|» message|string|true|none||none|

# 用户（Users）

<a id="opIdListUsers"></a>

## GET 获取用户列表 ListUsers

GET /users

获取用户列表
List all users

### Params

|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|Authorization|header|string| yes |none|

> Response Examples

> Success

```json
{
  "statusCode": 200,
  "data": {
    "users": [
      {
        "username": "admin",
        "roles": [
          "IT Operator",
          "byoc"
        ],
        "creator": "admin",
        "permissions": [
          "checkpoint:all",
          "inference:all",
          "role:all",
          "sagemaker_endpoint:all",
          "train:all",
          "user:all"
        ],
        "password": "********"
      },
      {
        "username": "username",
        "roles": [
          "IT Operator"
        ],
        "creator": "admin",
        "permissions": [
          "checkpoint:all",
          "inference:all",
          "role:all",
          "sagemaker_endpoint:all",
          "train:all",
          "user:all"
        ],
        "password": "********"
      }
    ],
    "previous_evaluated_key": "not_applicable",
    "last_evaluated_key": "not_applicable"
  },
  "message": "OK"
}
```

### Responses

|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Success|Inline|

### Responses Data Schema

HTTP Status Code **200**

|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» statusCode|integer|true|none||none|
|» data|object|true|none||none|
|»» users|[object]|true|none||none|
|»»» username|string|true|none||none|
|»»» roles|[string]|true|none||none|
|»»» creator|string|true|none||none|
|»»» permissions|[string]|true|none||none|
|»»» password|string|true|none||none|
|»» previous_evaluated_key|string|true|none||none|
|»» last_evaluated_key|string|true|none||none|
|» message|string|true|none||none|

<a id="opIdCreateUser"></a>

## POST 创建用户 CreateUser

POST /users

创建新用户
Create a new user

> Body Parameters

```json
{
  "username": "username",
  "password": "XXXXXXXXXXXXX",
  "creator": "admin",
  "roles": [
    "IT Operator"
  ]
}
```

### Params

|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|Authorization|header|string| yes |none|
|body|body|object| no |none|
|» username|body|string| yes |用户名（User Name）|
|» roles|body|[string]| yes |角色列表（Roles）|
|» creator|body|string| yes |创建者用户名（Creator User Name）|
|» permissions|body|[string]| yes |权限列表（Permissions）|
|» password|body|string| yes |密码（Password）|

> Response Examples

> Created

```json
{
  "statusCode": 201,
  "message": "Created"
}
```

### Responses

|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|Created|Inline|

### Responses Data Schema

HTTP Status Code **201**

|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» statusCode|integer|true|none||none|
|» message|string|true|none||none|

<a id="opIdDeleteUser"></a>

## DELETE 删除用户 DeleteUsers

DELETE /users

删除用户
Delete users

> Body Parameters

```json
{
  "user_name_list": [
    "string"
  ]
}
```

### Params

|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|Authorization|header|string| yes |none|
|body|body|object| no |none|
|» user_name_list|body|[string]| yes |用户名列表（User Name List）|

> Response Examples

> 204 Response

```json
{}
```

### Responses

|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|No Content|Inline|

### Responses Data Schema

# 模型文件（Checkpoints）

<a id="opIdCreateCheckpoint"></a>

## POST 通过URL上传模型文件 CreateCheckpoint

POST /checkpoints

通过URL上传模型文件
Create a new Checkpoint by URL

> Body Parameters

```json
{
  "checkpoint_type": "ControlNet",
  "params": {
    "message": "placeholder for chkpts upload test",
    "creator": "admin"
  },
  "urls": [
    "https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny.pth"
  ]
}
```

### Params

|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|Authorization|header|string| yes |none|
|body|body|object| no |none|
|» checkpoint_type|body|string| yes |模型文件类型（Checkpoint Type）|
|» params|body|object| yes |参数（Params）|
|»» message|body|string| yes |模型文件信息（Message）|
|»» creator|body|string| yes |创建者用户名（Creator User Name）|
|» urls|body|[string]| yes |URLs|

> Response Examples

> Accepted

```json
{
  "statusCode": 202,
  "message": "Checkpoint creation in progress, please check later"
}
```

### Responses

|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|202|[Accepted](https://tools.ietf.org/html/rfc7231#section-6.3.3)|Accepted|Inline|

### Responses Data Schema

HTTP Status Code **202**

|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» statusCode|integer|true|none||none|
|» data|object|true|none||none|
|»» checkpoint|object|true|none||none|
|»»» id|string|true|none||none|
|»»» type|string|true|none||none|
|»»» s3_location|string|true|none||none|
|»»» status|string|true|none||none|
|»»» params|object|true|none||none|
|»»»» message|string|true|none||none|
|»»»» creator|string|true|none||none|
|»»»» created|string|true|none||none|
|»»»» multipart_upload|object|true|none||none|
|»»»»» v1-5-pruned-emaonly.safetensors2|object|true|none||none|
|»»»»»» upload_id|string|true|none||none|
|»»»»»» bucket|string|true|none||none|
|»»»»»» key|string|true|none||none|
|»» s3PresignUrl|object|true|none||none|
|»»» v1-5-pruned-emaonly.safetensors2|[string]|true|none||none|
|» message|string|true|none||none|

<a id="opIdListCheckpoints"></a>

## DELETE 删除模型文件 DeleteCheckpoints

DELETE /checkpoints

删除模型文件
Delete checkpoints

> Body Parameters

```json
{
  "checkpoint_id_list": [
    "string"
  ]
}
```

### Params

|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|Authorization|header|string| yes |none|
|body|body|object| no |none|
|» checkpoint_id_list|body|[string]| yes |模型文件ID列表（ID List）|

> Response Examples

> 204 Response

```json
{}
```

### Responses

|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|No Content|Inline|

### Responses Data Schema

<a id="opIdUpdateCheckpoint"></a>

## PUT 更新模型文件状态 UpdateCheckpoint

PUT /checkpoints/{id}

更新模型文件状态
Update Checkpoint

> Body Parameters

```json
{
  "status": "Active",
  "multi_parts_tags": {
    "v1-5-pruned-emaonly.safetensors": [
      {
        "ETag": "\"e6279f0ad8bf8048c0d106095c4d4b24\"",
        "PartNumber": 1
      },
      {
        "ETag": "\"01a458e7d019140cb792b577596b7918\"",
        "PartNumber": 2
      },
      {
        "ETag": "\"296e59a1fb1ea02f6512c5b4c4565bea\"",
        "PartNumber": 3
      },
      {
        "ETag": "\"9dd22961ddf32130a22b36dc53f93fd0\"",
        "PartNumber": 4
      },
      {
        "ETag": "\"bfb91caed0e9f1aaaca7a0f125e7e96b\"",
        "PartNumber": 5
      }
    ]
  }
}
```

### Params

|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|id|path|string| yes |none|
|body|body|object| no |none|
|» status|body|string| yes |状态（Status）|
|» multi_parts_tags|body|object| yes |ETags|
|»» v1-5-pruned-emaonly.safetensors|body|[object]| yes |none|
|»»» ETag|body|string| yes |none|
|»»» PartNumber|body|integer| yes |none|

> Response Examples

> Success

```json
{
  "statusCode": 200,
  "headers": {
    "Access-Control-Allow-Headers": "Content-Type",
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Allow-Methods": "OPTIONS,POST,GET"
  },
  "checkpoint": {
    "id": "d613760c-c8f7-466a-9838-cea3033bf57d",
    "type": "Stable-diffusion",
    "s3_location": "s3://******/Stable-diffusion/checkpoint/custom/d613760c-c8f7-466a-9838-cea3033bf57d",
    "status": "Initial",
    "params": {
      "creator": "admin",
      "multipart_upload": {
        "v1-5-pruned-emaonly.safetensors": {
          "bucket": "******",
          "upload_id": "KFzbB7FwAuCDkR3NRaAO81uNM6E38KrvbB9m9T2dPlE0XUbOXrDB0c9CbhpLA3wFqnN6uTf0qh7HOYOmSXFwicHYOL7XfPMAhsT0cbxRhWvbyKPo8bO_wXrFcbUMDY.ef4vFZNKfdKaRba23Src44CrwGtYjkp3RQ8dEZubjleVTTTz0gaclwjfxmrdpqcZa",
          "key": "Stable-diffusion/checkpoint/custom/d613760c-c8f7-466a-9838-cea3033bf57d/v1-5-pruned-emaonly.safetensors"
        }
      },
      "message": "api-test-message",
      "created": "2023-12-07 00:45:59.334826"
    }
  }
}
```

### Responses

|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Success|Inline|

### Responses Data Schema

HTTP Status Code **200**

|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» statusCode|integer|true|none||Status Code|
|» headers|object|true|none||none|
|»» Access-Control-Allow-Headers|string|true|none||none|
|»» Access-Control-Allow-Origin|string|true|none||none|
|»» Access-Control-Allow-Methods|string|true|none||none|
|» checkpoint|object|true|none||Checkpoint|
|»» id|string|true|none||ID|
|»» type|string|true|none||Type|
|»» s3_location|string|true|none||S3 Key|
|»» status|string|true|none||Status|
|»» params|object|true|none||none|
|»»» creator|string|true|none||User Name|
|»»» multipart_upload|object|true|none||S3 Multipart Upload|
|»»»» v1-5-pruned-emaonly.safetensors|object|true|none||none|
|»»»»» bucket|string|true|none||none|
|»»»»» upload_id|string|true|none||none|
|»»»»» key|string|true|none||none|
|»»» message|string|true|none||Message|
|»»» created|string|true|none||Created At|

# 推理端点（Endpoints）

<a id="opIdListEndpoints"></a>

## GET 获取端点列表 ListEndpoints

GET /endpoints

获取推理端点列表
List inference endpoints

### Params

|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|Authorization|header|string| yes |none|

> Response Examples

> Success

```json
{
  "statusCode": 200,
  "data": {
    "endpoints": [
      {
        "EndpointDeploymentJobId": "d1253aa5-c884-4989-a7d1-d8806bc4fa59",
        "autoscaling": false,
        "max_instance_number": "1",
        "startTime": "2024-01-30 07:59:46.842717",
        "status": null,
        "instance_type": "ml.g4dn.2xlarge",
        "current_instance_count": "1",
        "endTime": "2024-01-30 08:03:33.991793",
        "endpoint_status": "InService",
        "endpoint_name": "esd-real-time-api-test",
        "error": null,
        "endpoint_type": "Real-time",
        "owner_group_or_role": [
          "byoc"
        ]
      },
      {
        "EndpointDeploymentJobId": "a50ba02e-057f-433d-83be-0f52fdd45b13",
        "autoscaling": true,
        "max_instance_number": "1",
        "startTime": "2024-01-26 08:19:52.759748",
        "status": null,
        "instance_type": "ml.g4dn.xlarge",
        "current_instance_count": "0",
        "endTime": "2024-02-02 03:58:32.946464",
        "endpoint_status": "InService",
        "endpoint_name": "esd-async-api-test",
        "error": null,
        "endpoint_type": "Async",
        "owner_group_or_role": [
          "IT Operator"
        ]
      }
    ]
  },
  "message": "OK"
}
```

### Responses

|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Success|Inline|

### Responses Data Schema

HTTP Status Code **200**

|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» statusCode|integer|true|none||none|
|» data|object|true|none||none|
|»» endpoints|[object]|true|none||none|
|»»» EndpointDeploymentJobId|string|true|none||none|
|»»» autoscaling|boolean|true|none||none|
|»»» max_instance_number|string|true|none||none|
|»»» startTime|string|true|none||none|
|»»» status|null|true|none||none|
|»»» instance_type|string|true|none||none|
|»»» current_instance_count|string|true|none||none|
|»»» endTime|string|true|none||none|
|»»» endpoint_status|string|true|none||none|
|»»» endpoint_name|string|true|none||none|
|»»» error|null|true|none||none|
|»»» endpoint_type|string|true|none||none|
|»»» owner_group_or_role|[string]|true|none||none|
|» message|string|true|none||none|

<a id="opIdCreateEndpoint"></a>

## POST 创建端点 CreateEndpoint

POST /endpoints

创建推理端点
Create Endpoint

> Body Parameters

```json
{
  "endpoint_name": "test",
  "endpoint_type": "Async",
  "instance_type": "ml.g5.2xlarge",
  "initial_instance_count": "1",
  "autoscaling_enabled": false,
  "assign_to_roles": [
    "IT Operator"
  ],
  "creator": "admin"
}
```

### Params

|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|Authorization|header|string| yes |none|
|body|body|object| no |none|
|» endpoint_name|body|string| no |端点名称（Endpoint Name）|
|» endpoint_type|body|string| yes |端点类型（Endpoint Type）|
|» instance_type|body|string| yes |实例类型（Instance Type）|
|» initial_instance_count|body|string| yes |初始实例数（Initial Instance Count）|
|» autoscaling_enabled|body|boolean| yes |开启 Autoscaling（Enable Autoscaling）|
|» assign_to_roles|body|[string]| yes |角色列表（Role List）|
|» creator|body|string| yes |创建者用户名（Creator User Name）|

> Response Examples

> Success

```json
{
  "statusCode": 200,
  "message": "Endpoint deployment started: esd-type-prod",
  "data": {
    "EndpointDeploymentJobId": "60b12a2e-c54d-496c-b405-1bc77b17e2f9",
    "autoscaling": false,
    "max_instance_number": "1",
    "startTime": "2023-12-07 01:08:43.410628",
    "status": null,
    "current_instance_count": "0",
    "endTime": null,
    "endpoint_status": "Creating",
    "endpoint_name": "esd-type-prod",
    "error": null,
    "owner_group_or_role": [
      "IT Operator"
    ]
  }
}
```

### Responses

|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Success|Inline|

### Responses Data Schema

HTTP Status Code **200**

|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» statusCode|integer|true|none||none|
|» message|string|true|none||none|
|» data|[Endpoint](#schemaendpoint)|true|none||none|
|»» EndpointDeploymentJobId|string|true|none||ID|
|»» autoscaling|boolean|true|none||Autoscaling Enabled|
|»» max_instance_number|string|true|none||Max Instance Count|
|»» startTime|string|true|none||Start Time|
|»» current_instance_count|integer|true|none||Current Instance Count|
|»» endTime|string|true|none||End Time|
|»» endpoint_status|string|true|none||Endpoint Status|
|»» endpoint_name|string|true|none||Endpoint Name|
|»» error|null|true|none||Error Message|
|»» owner_group_or_role|[string]|true|none||Roles|

<a id="opIdDeleteEndpoints"></a>

## DELETE 删除端点 DeleteEndpoints

DELETE /endpoints

删除推理端点
Delete endpoints

> Body Parameters

```json
{
  "delete_endpoint_list": [
    "esd-type-test"
  ],
  "username": "admin"
}
```

### Params

|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|Authorization|header|string| yes |none|
|body|body|object| no |none|
|» delete_endpoint_list|body|[string]| yes |端点名列表（Endpoint Name List）|
|» username|body|string| yes |用户名（User Name）|

> Response Examples

> 200 Response

```json
{}
```

### Responses

|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Success|Inline|

### Responses Data Schema

# 推理（Inferences）

<a id="opIdCreateInferenceJob"></a>

## POST 创建推理作业 CreateInferenceJob

POST /inferences

创建推理作业，创建成功后，需要通过返回的`api_params_s3_upload_url` 上传推理参数
Create inference, When you got response, you have to upload your Payload to `api_params_s3_upload_url`

> Body Parameters

```json
{
  "user_id": "admin",
  "inference_type": "Async",
  "task_type": "txt2img",
  "models": {
    "Stable-diffusion": [
      "v1-5-pruned-emaonly.safetensors"
    ],
    "VAE": [
      "Automatic"
    ],
    "embeddings": []
  },
  "filters": {
    "createAt": 1707141090.135923,
    "creator": "sd-webui"
  }
}
```

### Params

|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|body|body|object| no |none|
|» user_id|body|string| yes |用户名（User Name）|
|» inference_type|body|string| yes |推理类型（Inference Type）Async | Real-time|
|» task_type|body|string| yes |任务类型（Task Type）txt2img | img2img | rembg|
|» models|body|object| yes |模型列表（Model List）|
|»» Stable-diffusion|body|[string]| yes |none|
|»» VAE|body|[string]| yes |none|
|»» embeddings|body|[string]| yes |none|
|» filters|body|object| yes |将在下一版本中移除|
|»» createAt|body|number| yes |none|
|»» creator|body|string| yes |none|

> Response Examples

> Success

```json
{
  "statusCode": 201,
  "data": {
    "inference": {
      "id": "f3421ce5-9ab9-40a2-b33b-3f126de70a52",
      "type": "txt2img",
      "api_params_s3_location": "s3://xxxx/txt2img/infer_v2/f3421ce5-9ab9-40a2-b33b-3f126de70a52/api_param.json",
      "api_params_s3_upload_url": "https://xxxx.s3.amazonaws.com/txt2img/infer_v2/f3421ce5-9ab9-40a2-b33b-3f126de70a52/api_param.json?AWSAccessKeyId=xxxx&Signature=HNp81KZy2%2FDSgz7%2FWP%2FdMIUPz8s%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEOz%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDmFw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Hcgu%2Bw%3D%3D&Expires=1707194752",
      "models": [
        {
          "id": "32a7af23-3763-4289-a6af-2156a2331878",
          "name": [
            "v1-5-pruned-emaonly.safetensors"
          ],
          "type": "Stable-diffusion"
        },
        {
          "id": "VAE",
          "name": [
            "Automatic"
          ],
          "type": "VAE"
        }
      ]
    }
  },
  "message": "Created"
}
```

### Responses

|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Success|Inline|

### Responses Data Schema

HTTP Status Code **200**

|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» statusCode|integer|true|none||none|
|» data|object|true|none||none|
|»» inference|object|true|none||none|
|»»» id|string|true|none||none|
|»»» type|string|true|none||none|
|»»» api_params_s3_location|string|true|none||none|
|»»» api_params_s3_upload_url|string|true|none||none|
|»»» models|[object]|true|none||none|
|»»»» id|string|true|none||none|
|»»»» name|[string]|true|none||none|
|»»»» type|string|true|none||none|
|» message|string|true|none||none|

<a id="opIdListInferenceJobs"></a>

## DELETE 删除推理作业 DeleteInferenceJobs

DELETE /inferences

删除推理作业列表
Delete inference jobs

> Body Parameters

```json
{
  "inference_id_list": [
    "99"
  ]
}
```

### Params

|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|Authorization|header|string| no |none|
|body|body|object| no |none|
|» inference_id_list|body|[string]| yes |推理作业ID列表（Inference Job ID List）|

> Response Examples

> No Content

```json
{}
```

### Responses

|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|No Content|Inline|

### Responses Data Schema

<a id="opIdRunInferenceJob"></a>

## PUT 开始推理作业 StartInferenceJob

PUT /inferences/{jobId}/start

开始推理作业
Start inference job

### Params

|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|jobId|path|string| yes |推理作业ID（Inference Job ID）|
|Authorization|header|string| yes |none|

> Response Examples

> Success

```json
{
  "statusCode": 202,
  "data": {
    "inference": {
      "inference_id": "f3421ce5-9ab9-40a2-b33b-3f126de70a52",
      "status": "inprogress",
      "endpoint_name": "esd-async-97fce5e",
      "output_path": "s3://xxxx/sagemaker_output/48159016-c040-4b49-8a1c-b57445946918.out"
    }
  },
  "message": "Accepted"
}
```

### Responses

|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Success|Inline|

### Responses Data Schema

HTTP Status Code **200**

|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» statusCode|integer|true|none||none|
|» data|object|true|none||none|
|»» inference|object|true|none||none|
|»»» inference_id|string|true|none||none|
|»»» status|string|true|none||none|
|»»» endpoint_name|string|true|none||none|
|»»» output_path|string|true|none||none|
|» message|string|true|none||none|

<a id="opIdGetInferenceJob"></a>

## GET 获取推理作业详情 GetInferenceJob

GET /inferences/{jobId}

获取指定的推理作业详情
Gets a specific inference job

### Params

|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|jobId|path|string| yes |推理作业ID（Inference Job ID）|
|Authorization|header|string| yes |none|

> Response Examples

> Success

```json
{
  "statusCode": 200,
  "data": {
    "img_presigned_urls": [
      "https://xxxx.s3.amazonaws.com/out/9d93e241-745a-4464-bb99-22253c910a01/result/image_0.png?AWSAccessKeyId=xxxx&Signature=%2BIoU%2BUuY0oJmd9yb8B6xJGnRN3Q%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEOz%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDmFwLXNvdXRoZWFzdC0xIkgwRgIhAJXX4Y7cAU1VjSQK3Ga5Q3oWrK9Pu7e%2BaJ%2FcP89H3DnAAiEAw%2FSIHzSWR01mAw6xb2kqhTgkapA3hRzRlmIgb%2FQuuNsq4QMItf%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARAAGgw4NjA2NjA2MDA2OTAiDI5nIbuU88AEtxiKeSq1A0em0PiCJywBO91ACgdnEOZhh46%2BcPMBZS8sbo2G7FuNR8VRz4nGIQjp4HdX468AMjoAN7tRidsufLva6L2xTrqmiiEZobRLqc%2FgsJnuxkK0FFbmdW%2B4GSjUWC8NIyICwF4KtL%2FS05fYVQyq5%2FBV%2B%2FVMw0aT5m7ai4E9FkHAgTsMvhxg31L3v%2BPe8A8Y%2BZbuWGdvonMzHE4CYMKAKe6SfvjK7u8U8YHR8IeCFWd90jzlkygIk83oFVOuyybITePaZbxWKuyEvBSJd3T7y46CeThyzc3I8AlmYTrfbuj8BhSqiptedtN5%2BmtMP5q04c3EGpIQ86B13NAUhHDadBeImztplPRLJFUXJsj7AMUHc5I7h8o%2BRXy1xE4GZD382WXsHOKLJ39UkioqRUvWCAozO%2B%2FBsILadh83RUcE7C7HFGd6%2BdnfcWPfjDOr5i%2FI5P%2BeamDL9Cvw9hakaaMSryI8ki3kmMMbubBc2JExOtspIh3SquN2dw6RUtb34mBZerxZhJHNGFsdARrboM7IZA1f8S6oGuMRX7tr67P%2Fgx5alSHiiS%2FvFlNyPqIRk7O3uAlnzLkQ7IgyMO%2FZhq4GOp0B1Fyc2ySOy88xOUvUFDkJHr5dpVYIOkffdqOgGXOi9H0edCyg8xELWZwofu6eT%2FecDv4xvjkHjXyJ%2B3H7KP1%2FmE2IoQSFJBFvI0El1rvg7jsvROTe8QVuNYG9V1PqH3zLLz%2Fw9V1R9fK6ys5ZdlDCm208LClKZq8YlxQWXlOO%2FLMLcR51FJxqu5tqXLAaVIFDNdwO%2BrUyvZx5xMTifg%3D%3D&Expires=1707195462"
    ],
    "output_presigned_urls": [
      "https://xxxx.s3.amazonaws.com/out/9d93e241-745a-4464-bb99-22253c910a01/result/9d93e241-745a-4464-bb99-22253c910a01_param.json?AWSAccessKeyId=xxxx&Signature=sAi%2ByxVsUBdZfSh34QCMAh%2B2jGg%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEOz%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDmFwLXNvdXRoZWFzdC0xIkgwRgIhAJX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taskType": "txt2img",
    "completeTime": "2024-02-05 06:10:56.270528",
    "params": {
      "input_body_presign_url": "https://xxxx.s3.amazonaws.com/txt2img/infer_v2/9d93e241-745a-4464-bb99-22253c910a01/api_param.json?AWSAccessKeyId=xxxx&Signature=i8q7mM74oZoqtl6reQCPEklgXkc%3D&x-amz-security-token=IQoJb3JpZ2luX2VjENb%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDmFwLXNvdXRoZWFzdC0xIkgwRgIhALn6k5IG2ikYnvMq55N8qzxoi0PcGaPgqzQiNfqjU2ueAiEAlD%2B36qo6fakPvbFIO%2FCEBq3OWIZy3PVRc50g11Yh%2BLAq4QMIn%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARAAGgw4NjA2NjA2MDA2OTAiDP6CmhQmhgcfvjTYpSq1A%2FUxhB9s6Vam%2FSSyEYlgMkVgvRGOntmYPgfgAdGj9j37KcncPzUxzsuttNgVQzP%2Bu9CVAI4QrO02ObsyNPvsy3KOCLmpBRcSmZDqRkPW5%2BTmQwVEAD8AYut7P3CiLt0mIcCcMS8UOZuXbvb6%2FyaPAegYR20bUEfPDiOEvYxyBOrj9%2FdbED5lvSrS3fHucyIVk9wF6tJQQVucqWRA1qllL6Dj%2BIg86dFYkLl2BiYty0Vd0OBT6y51ATmhBJqqz66M5MlKuVvxWZ5ZL7T%2BcNcJyPnukXAADGuBXt6ZjD7QWxve7TQE6aUTHGi6WbF%2FLi0%2BqWOmVoKdootyVT3bCj34rA56NudSO5t0QjBonQ%2BfnFJlB7s1if4UHZUp%2FijPImWJU8uC6PMp9Qshgux3IwCjO6X%2B5GcyWnL1hO5GaljtyERBLQZ8SS2ZHej3kSw9cJ3w%2FN5cCgejLWkbNffQdkyan1XsRav9ufZOHQMNtupz0LEsUIvbctZjip3FLdBp0rwZDfrBEFlpuDEnmzpCbJVIw7BajO7Fqtu%2FzYHeyEH7ZLLHSMFSkK4apzXb2gkhpmM44XalQzu7MLb1ga4GOp0BghTpORcI%2F6KMUkPVI3YuuZ7O5HLQTlq8TYtl9%2BEWIpG8omXyk232ysXfV4hgvVNA1yOfBpa0IEY86LVLIUOGRgNgPtAkBp2Mao9lA0GcAh2XGCCJYRFyvwVU1veBhN5XgNA15dy1Vqp9YC2ZtwMiTxQcy5R6vlm8mI2cKaI0RJWlD9gWhRhlZJZVx5RTgYI6jjhnr0Zis3L52wmd0A%3D%3D&Expires=1707117052",
      "used_models": {
        "Stable-diffusion": [
          {
            "s3": "s3://xxxx/Stable-diffusion/checkpoint/custom/32a7af23-3763-4289-a6af-2156a2331878",
            "id": "32a7af23-3763-4289-a6af-2156a2331878",
            "model_name": "v1-5-pruned-emaonly.safetensors",
            "type": "Stable-diffusion"
          }
        ],
        "VAE": [
          {
            "s3": "None",
            "id": "VAE",
            "model_name": "Automatic",
            "type": "VAE"
          }
        ]
      },
      "input_body_s3": "s3://xxxx/txt2img/infer_v2/9d93e241-745a-4464-bb99-22253c910a01/api_param.json",
      "sagemaker_inference_instance_type": "ml.g4dn.2xlarge",
      "sagemaker_inference_endpoint_id": "9ef3c8bf-936e-47bb-a6da-e11e43140fb1",
      "sagemaker_inference_endpoint_name": "esd-real-time-9ef3c8b"
    },
    "InferenceJobId": "9d93e241-745a-4464-bb99-22253c910a01",
    "status": "succeed",
    "inference_type": "Real-time",
    "createTime": "2024-02-05 06:10:52.299624",
    "image_names": [
      "image_0.png"
    ],
    "owner_group_or_role": [
      "admin"
    ]
  },
  "message": "OK"
}
```

### Responses

|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Success|Inline|

### Responses Data Schema

HTTP Status Code **200**

|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» statusCode|integer|true|none||none|
|» data|object|true|none||none|
|»» img_presigned_urls|[string]|true|none||none|
|»» output_presigned_urls|[string]|true|none||none|
|»» startTime|string|true|none||none|
|»» taskType|string|true|none||none|
|»» completeTime|string|true|none||none|
|»» params|object|true|none||none|
|»»» input_body_presign_url|string|true|none||none|
|»»» used_models|object|true|none||none|
|»»»» Stable-diffusion|[object]|true|none||none|
|»»»»» s3|string|false|none||none|
|»»»»» id|string|false|none||none|
|»»»»» model_name|string|false|none||none|
|»»»»» type|string|false|none||none|
|»»»» VAE|[object]|true|none||none|
|»»»»» s3|string|false|none||none|
|»»»»» id|string|false|none||none|
|»»»»» model_name|string|false|none||none|
|»»»»» type|string|false|none||none|
|»»» input_body_s3|string|true|none||none|
|»»» sagemaker_inference_instance_type|string|true|none||none|
|»»» sagemaker_inference_endpoint_id|string|true|none||none|
|»»» sagemaker_inference_endpoint_name|string|true|none||none|
|»» InferenceJobId|string|true|none||none|
|»» status|string|true|none||none|
|»» inference_type|string|true|none||none|
|»» createTime|string|true|none||none|
|»» image_names|[string]|true|none||none|
|»» owner_group_or_role|[string]|true|none||none|
|» message|string|true|none||none|

# Data Schema

<h2 id="tocS_Checkpoint">Checkpoint</h2>

<a id="schemacheckpoint"></a>
<a id="schema_Checkpoint"></a>
<a id="tocScheckpoint"></a>
<a id="tocscheckpoint"></a>

```json
{
  "id": "string",
  "s3Location": "string",
  "type": "string",
  "status": "string",
  "name": [
    "string"
  ],
  "created": 0,
  "allowed_roles_or_users": [
    "string"
  ]
}

```

### Attribute

|Name|Type|Required|Restrictions|Title|Description|
|---|---|---|---|---|---|
|id|string|true|none||none|
|s3Location|string|true|none||none|
|type|string|true|none||none|
|status|string|true|none||none|
|name|[string]|true|none||none|
|created|number|true|none||none|
|allowed_roles_or_users|[string]|true|none||none|

<h2 id="tocS_Endpoint">Endpoint</h2>

<a id="schemaendpoint"></a>
<a id="schema_Endpoint"></a>
<a id="tocSendpoint"></a>
<a id="tocsendpoint"></a>

```json
{
  "EndpointDeploymentJobId": "string",
  "autoscaling": true,
  "max_instance_number": "string",
  "startTime": "string",
  "current_instance_count": 0,
  "endTime": "string",
  "endpoint_status": "string",
  "endpoint_name": "string",
  "error": null,
  "owner_group_or_role": [
    "string"
  ]
}

```

### Attribute

|Name|Type|Required|Restrictions|Title|Description|
|---|---|---|---|---|---|
|EndpointDeploymentJobId|string|true|none||ID|
|autoscaling|boolean|true|none||Autoscaling Enabled|
|max_instance_number|string|true|none||Max Instance Count|
|startTime|string|true|none||Start Time|
|current_instance_count|integer|true|none||Current Instance Count|
|endTime|string|true|none||End Time|
|endpoint_status|string|true|none||Endpoint Status|
|endpoint_name|string|true|none||Endpoint Name|
|error|null|true|none||Error Message|
|owner_group_or_role|[string]|true|none||Roles|

<h2 id="tocS_User">User</h2>

<a id="schemauser"></a>
<a id="schema_User"></a>
<a id="tocSuser"></a>
<a id="tocsuser"></a>

```json
{
  "username": "string",
  "roles": [
    "string"
  ],
  "creator": "string",
  "permissions": [
    "string"
  ],
  "password": "string"
}

```

### Attribute

|Name|Type|Required|Restrictions|Title|Description|
|---|---|---|---|---|---|
|username|string|true|none||用户名（User Name）|
|roles|[string]|true|none||角色列表（Roles）|
|creator|string|true|none||创建者用户名（Creator User Name）|
|permissions|[string]|true|none||权限列表（Permissions）|
|password|string|true|none||密码（Password）|

<h2 id="tocS_InferenceJob">InferenceJob</h2>

<a id="schemainferencejob"></a>
<a id="schema_InferenceJob"></a>
<a id="tocSinferencejob"></a>
<a id="tocsinferencejob"></a>

```json
{
  "startTime": "string",
  "taskType": "string",
  "completeTime": "string",
  "params": {
    "input_body_presign_url": "string",
    "used_models": {
      "Stable-diffusion": [
        {
          "s3": "string",
          "id": "string",
          "model_name": "string",
          "type": "string"
        }
      ],
      "Lora": [
        {
          "s3": "string",
          "id": "string",
          "model_name": "string",
          "type": "string"
        }
      ]
    },
    "input_body_s3": "string",
    "output_path": "string",
    "sagemaker_inference_endpoint_id": "string",
    "sagemaker_inference_endpoint_name": "string"
  },
  "InferenceJobId": "string",
  "status": "string",
  "sagemakerRaw": "string",
  "image_names": [
    "string"
  ],
  "owner_group_or_role": [
    "string"
  ]
}

```

### Attribute

|Name|Type|Required|Restrictions|Title|Description|
|---|---|---|---|---|---|
|startTime|string|true|none||Start Time|
|taskType|string|true|none||Task Type|
|completeTime|string|true|none||Complete Time|
|params|object|true|none||Params|
|» input_body_presign_url|string|true|none||none|
|» used_models|object|true|none||none|
|»» Stable-diffusion|[object]|true|none||none|
|»»» s3|string|false|none||none|
|»»» id|string|false|none||none|
|»»» model_name|string|false|none||none|
|»»» type|string|false|none||none|
|»» Lora|[object]|true|none||none|
|»»» s3|string|false|none||none|
|»»» id|string|false|none||none|
|»»» model_name|string|false|none||none|
|»»» type|string|false|none||none|
|» input_body_s3|string|true|none||none|
|» output_path|string|true|none||none|
|» sagemaker_inference_endpoint_id|string|true|none||none|
|» sagemaker_inference_endpoint_name|string|true|none||none|
|InferenceJobId|string|true|none||Inference Job Id|
|status|string|true|none||Status|
|sagemakerRaw|string|true|none||Sagemaker Raw|
|image_names|[string]|true|none||Images Array|
|owner_group_or_role|[string]|true|none||Roles|

<h2 id="tocS_Role">Role</h2>

<a id="schemarole"></a>
<a id="schema_Role"></a>
<a id="tocSrole"></a>
<a id="tocsrole"></a>

```json
{
  "role_name": "string",
  "creator": "string",
  "permissions": [
    "string"
  ]
}

```

### Attribute

|Name|Type|Required|Restrictions|Title|Description|
|---|---|---|---|---|---|
|role_name|string|true|none||角色名（Role Name）|
|creator|string|true|none||创建者用户名（Creator User Name）|
|permissions|[string]|true|none||权限列表（Permissions）|

