> ## Documentation Index
> Fetch the complete documentation index at: https://developers.redo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# updateWorkspace

> Apply text edits to a workspace, in order. Edits fail only mechanically (stale revision, text not found or ambiguous, more than 100 edits or 1 MB); text that doesn't parse is reported in `diagnostics`. Changes only the working copy. Null if the workspace is gone.

**Required scopes:** [`automations_write`](/docs/api-reference/v3/reference/scopes#scope-automations_write)

## Arguments

**edits** *required*

The edits to apply, in order.

**fields**

**all** `Boolean`

Replace every occurrence of `find`.

**find** `String`

Exact text to find, including whitespace.

**replace** `String!` *required*

The new text.

**expectedRevision** `String!` *required*

The workspace `revision` your edits are based on.

**id** `ID!` *required*

The workspace's id.

## Returns

**updateWorkspace**

A working copy of one resource, as text. Edit it with `updateWorkspace`, check `diagnostics`, then save it with `commitWorkspace`. Expires 7 days after its last change.

**fields**

**diagnostics** *required*

Problems in the current text. Commit refuses while any is an ERROR. Apply a fix by passing its `edits` to `updateWorkspace`.

**fields**

**code** `String!` *required*

A stable code, such as E0101.

**column** `Int`

1-based column on that line.

**fixes** *required*

Suggested fixes, best first.

**fields**

**edits** *required*

The edits, in order.

**needsInput** `Boolean!` *required*

True when the edits insert a placeholder you must fill in before committing.

**title** `String!` *required*

What the fix does.

**line** `Int`

1-based line in the document, when it has one.

**message** `String!` *required*

What is wrong.

**severity** *required*

How much it matters.

**document** `String!` *required*

The working copy's text. Pass `startLine` and `endLine` (1-based, inclusive) to read part of it.

**fields**

**Arguments**

**endLine** `Int`

Last line.

**startLine** `Int`

First line.

**expiresAt** *required*

When the workspace expires unless changed again.

**id** `ID!` *required*

The workspace's id.

**resourceId** `ID`

The resource it edits; null until a new resource is first committed.

**resourceType** *required*

What kind of resource it edits.

**revision** `String!` *required*

The workspace's current revision. Opaque; pass it as `expectedRevision` to `updateWorkspace` and `commitWorkspace`.

**stale** `Boolean!` *required*

True when the resource changed since this workspace started, so commit will return STALE. Start a new workspace and redo your edits.

## Example

```graphql theme={null}
mutation {
  updateWorkspace(edits: { ... }, expectedRevision: "...", id: "...") {
    document
    expiresAt
    id
    resourceId
    resourceType
    revision
    stale
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.