> ## 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.

# redoFunction

> Get one deployed function. An id from another account, or one that does not exist, is null.

**Required scopes:** [`functions_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-functions_read)

## Arguments

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

The id of the function.

## Returns

**redoFunction** `[RedoFunction](/docs/api-reference/v3/reference/developer/redo-function)`

A function the store has deployed to Redo and attached to a setting, such as a custom rate table, an OMS automation code step or an RMA function. It runs in Redo each time that setting needs it, for example at checkout. Function steps in developer automations are not listed here: their code is versioned with the automation and read from `Automation.script`.

**fields**

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

The source code of the function's current version.

**contractId** `String!` *required*

The contract the function's current code satisfies: the shape of the input it receives and the output it must return.

**createdAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *required*

When the function was first deployed.

**deployments** `[RedoFunctionDeploymentConnection!](/docs/api-reference/v3/pagination)` *required*

Every deployment of new code to this function, newest first, with the code each one deployed.

**Requires:** [`functions_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-functions_read)

**fields**

**Arguments**

**after** `String`

Forward pagination cursor — returns deployments after it.

**before** `String`

Backward pagination cursor — returns deployments before it.

**first** `Int`

Forward pagination: returns the first N deployments (max 100, default 25). Use with `after`; mutually exclusive with `last`/`before`.

**last** `Int`

Backward pagination: returns the last N deployments (max 100, default 25). Use with `before`; mutually exclusive with `first`/`after`.

**Fields**

**edges** `[\[RedoFunctionDeploymentEdge!\]!](/docs/api-reference/v3/pagination)` *required*

The list of edges (each a node plus its pagination `cursor`).

**fields**

**cursor** `String!` *required*

Opaque cursor for this item; pass to `after`/`before` to page from here.

**node** `[RedoFunctionDeployment!](/docs/api-reference/v3/reference/developer/redo-function-deployment)` *required*

The item at this edge.

**nodes** `[\[RedoFunctionDeployment!\]!](/docs/api-reference/v3/reference/developer/redo-function-deployment)` *required*

The nodes in this page, without the edge/cursor wrapper — a convenience over `edges`.

**fields**

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

The source code that was deployed.

**contractId** `String!` *required*

The contract this deployment's code satisfies.

**deployedAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *required*

When this code was deployed.

**pageInfo** `[PageInfo!](/docs/api-reference/v3/pagination)` *required*

Pagination metadata for the current page.

**fields**

**endCursor** `String`

Cursor of the last edge in this page; pass to `after` to page forward.

**hasNextPage** `Boolean!` *required*

Whether more items exist after this page (drives forward pagination with `first`/`after`).

**hasPreviousPage** `Boolean!` *required*

Whether more items exist before this page (drives backward pagination with `last`/`before`).

**startCursor** `String`

Cursor of the first edge in this page; pass to `before` to page backward.

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

The id of this function.

**lastDeployedAt** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

When new code was last deployed to this function. Null when no deployment is recorded.

**targetId** `String!` *required*

The stable identifier of the setting the function is attached to, such as a rate table's id. To list its runs, filter the developer log with `developerLogEntries(functionRun: { sourceId: <targetId> })`.

**targetType** `[RedoFunctionTargetType!](/docs/api-reference/v3/reference/developer/redo-function-target-type)` *required*

The kind of setting the function is attached to.

## Example

```graphql theme={null}
query {
  redoFunction(id: "...") {
    code
    contractId
    createdAt
    deployments {
      nodes {
        code
        contractId
        deployedAt
      }
      pageInfo { hasNextPage endCursor }
    }
    id
    lastDeployedAt
    targetId
    targetType
  }
}
```


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