## Partial Update Span

`client.spans.update(stringspanID, SpanUpdateParamsbody, RequestOptionsoptions?): Span`

**patch** `/spans/{span_id}`

Update a span with the provided output data and mark it as complete

### Parameters

- `spanID: string`

- `body: SpanUpdateParams`

  - `data?: Record<string, unknown> | Array<Record<string, unknown>> | null`

    Any additional metadata or context for the span

    - `Record<string, unknown>`

    - `Array<Record<string, unknown>>`

  - `end_time?: string | null`

    The time the span ended

  - `input?: Record<string, unknown> | Array<Record<string, unknown>> | null`

    Input parameters or data for the operation

    - `Record<string, unknown>`

    - `Array<Record<string, unknown>>`

  - `name?: string | null`

    Name that describes what operation this span represents

  - `output?: Record<string, unknown> | Array<Record<string, unknown>> | null`

    Output data resulting from the operation

    - `Record<string, unknown>`

    - `Array<Record<string, unknown>>`

  - `parent_id?: string | null`

    ID of the parent span if this is a child span in a trace

  - `start_time?: string | null`

    The time the span started

  - `task_id?: string | null`

    ID of the task this span belongs to

  - `trace_id?: string | null`

    Unique identifier for the trace this span belongs to

### Returns

- `Span`

  - `id: string`

  - `name: string`

    Name that describes what operation this span represents

  - `start_time: string`

    The time the span started

  - `trace_id: string`

    Unique identifier for the trace this span belongs to

  - `data?: Record<string, unknown> | Array<Record<string, unknown>> | null`

    Any additional metadata or context for the span

    - `Record<string, unknown>`

    - `Array<Record<string, unknown>>`

  - `end_time?: string | null`

    The time the span ended

  - `input?: Record<string, unknown> | Array<Record<string, unknown>> | null`

    Input parameters or data for the operation

    - `Record<string, unknown>`

    - `Array<Record<string, unknown>>`

  - `output?: Record<string, unknown> | Array<Record<string, unknown>> | null`

    Output data resulting from the operation

    - `Record<string, unknown>`

    - `Array<Record<string, unknown>>`

  - `parent_id?: string | null`

    ID of the parent span if this is a child span in a trace

  - `task_id?: string | null`

    ID of the task this span belongs to

### Example

```typescript
import Agentex from 'agentex';

const client = new Agentex({
  apiKey: process.env['AGENTEX_SDK_API_KEY'], // This is the default and can be omitted
});

const span = await client.spans.update('span_id');

console.log(span.id);
```

#### Response

```json
{
  "id": "id",
  "name": "name",
  "start_time": "2019-12-27T18:11:19.117Z",
  "trace_id": "trace_id",
  "data": {
    "foo": "bar"
  },
  "end_time": "2019-12-27T18:11:19.117Z",
  "input": {
    "foo": "bar"
  },
  "output": {
    "foo": "bar"
  },
  "parent_id": "parent_id",
  "task_id": "task_id"
}
```
